Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
1a515be7
Commit
1a515be7
authored
May 09, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify generated code by using PointerHelpers templates.
parent
e4784bc8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
485 deletions
+196
-485
generated-header-support.h
c++/src/capnproto/generated-header-support.h
+45
-40
layout.h
c++/src/capnproto/layout.h
+4
-4
list.h
c++/src/capnproto/list.h
+75
-67
CxxGenerator.hs
compiler/src/CxxGenerator.hs
+8
-0
c++-header.mustache
compiler/src/c++-header.mustache
+64
-374
No files found.
c++/src/capnproto/generated-header-support.h
View file @
1a515be7
...
@@ -36,12 +36,19 @@ class DynamicStruct; // So that it can be declared a friend.
...
@@ -36,12 +36,19 @@ class DynamicStruct; // So that it can be declared a friend.
namespace
internal
{
namespace
internal
{
template
<
typename
T
>
template
<
typename
T
>
struct
PointerHelpers
{
struct
PointerHelpers
<
T
,
Kind
::
STRUCT
>
{
static
inline
typename
T
::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
)
{
static
inline
typename
T
::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
,
return
typename
T
::
Reader
(
reader
.
getStructField
(
index
,
nullptr
));
const
word
*
defaultValue
=
nullptr
)
{
return
typename
T
::
Reader
(
reader
.
getStructField
(
index
,
defaultValue
));
}
}
static
inline
typename
T
::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
static
inline
typename
T
::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
,
return
typename
T
::
Builder
(
builder
.
getStructField
(
index
,
structSize
<
T
>
(),
nullptr
));
const
word
*
defaultValue
=
nullptr
)
{
return
typename
T
::
Builder
(
builder
.
getStructField
(
index
,
structSize
<
T
>
(),
defaultValue
));
}
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
typename
T
::
Reader
value
)
{
// TODO(soon)
CAPNPROTO_INLINE_PRECOND
(
false
,
"Not implemented: set() for struct fields."
);
}
}
static
inline
typename
T
::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
static
inline
typename
T
::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
return
typename
T
::
Builder
(
builder
.
initStructField
(
index
,
structSize
<
T
>
()));
return
typename
T
::
Builder
(
builder
.
initStructField
(
index
,
structSize
<
T
>
()));
...
@@ -49,48 +56,46 @@ struct PointerHelpers {
...
@@ -49,48 +56,46 @@ struct PointerHelpers {
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
PointerHelpers
<
List
<
T
>>
{
struct
PointerHelpers
<
List
<
T
>
,
Kind
::
LIST
>
{
static
inline
typename
List
<
T
>::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
)
{
static
inline
typename
List
<
T
>::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
,
return
typename
List
<
T
>::
Reader
(
List
<
T
>::
getAsFieldOf
(
reader
,
index
));
const
word
*
defaultValue
=
nullptr
)
{
}
return
typename
List
<
T
>::
Reader
(
List
<
T
>::
getAsFieldOf
(
reader
,
index
,
defaultValue
));
static
inline
typename
List
<
T
>::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
getAsFieldOf
(
builder
,
index
));
}
static
inline
typename
List
<
T
>::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
,
int
size
)
{
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
initAsFieldOf
(
builder
,
index
,
size
));
}
}
};
static
inline
typename
List
<
T
>::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
,
const
word
*
defaultValue
=
nullptr
)
{
template
<>
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
getAsFieldOf
(
builder
,
index
,
defaultValue
));
struct
PointerHelpers
<
Text
>
{
static
inline
Text
::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
)
{
return
reader
.
getBlobField
<
Text
>
(
index
,
nullptr
,
0
*
BYTES
);
}
}
static
inline
Text
::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
return
builder
.
getBlobField
<
Text
>
(
index
,
nullptr
,
0
*
BYTES
);
typename
List
<
T
>::
Reader
value
)
{
init
(
builder
,
index
,
value
.
size
()).
copyFrom
(
value
);
}
}
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
Text
::
Reader
value
)
{
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
builder
.
setBlobField
<
Text
>
(
index
,
value
);
std
::
initializer_list
<
ReaderFor
<
T
>>
value
)
{
init
(
builder
,
index
,
value
.
size
()).
copyFrom
(
value
);
}
}
static
inline
Text
::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
,
int
size
)
{
static
inline
typename
List
<
T
>::
Builder
init
(
return
builder
.
initBlobField
<
Text
>
(
index
,
size
*
BYTES
);
StructBuilder
builder
,
WireReferenceCount
index
,
uint
size
)
{
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
initAsFieldOf
(
builder
,
index
,
size
));
}
}
};
};
template
<>
template
<
typename
T
>
struct
PointerHelpers
<
Data
>
{
struct
PointerHelpers
<
T
,
Kind
::
BLOB
>
{
static
inline
Data
::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
)
{
static
inline
typename
T
::
Reader
get
(
StructReader
reader
,
WireReferenceCount
index
,
return
reader
.
getBlobField
<
Data
>
(
index
,
nullptr
,
0
*
BYTES
);
const
void
*
defaultValue
=
nullptr
,
}
uint
defaultBytes
=
0
)
{
static
inline
Data
::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
)
{
return
reader
.
getBlobField
<
T
>
(
index
,
defaultValue
,
defaultBytes
*
BYTES
);
return
builder
.
getBlobField
<
Data
>
(
index
,
nullptr
,
0
*
BYTES
);
}
}
static
inline
typename
T
::
Builder
get
(
StructBuilder
builder
,
WireReferenceCount
index
,
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
Data
::
Reader
value
)
{
const
void
*
defaultValue
=
nullptr
,
builder
.
setBlobField
<
Data
>
(
index
,
value
);
uint
defaultBytes
=
0
)
{
}
return
builder
.
getBlobField
<
T
>
(
index
,
defaultValue
,
defaultBytes
*
BYTES
);
static
inline
Data
::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
,
int
size
)
{
}
return
builder
.
initBlobField
<
Data
>
(
index
,
size
*
BYTES
);
static
inline
void
set
(
StructBuilder
builder
,
WireReferenceCount
index
,
typename
T
::
Reader
value
)
{
builder
.
setBlobField
<
T
>
(
index
,
value
);
}
static
inline
typename
T
::
Builder
init
(
StructBuilder
builder
,
WireReferenceCount
index
,
uint
size
)
{
return
builder
.
initBlobField
<
T
>
(
index
,
size
*
BYTES
);
}
}
};
};
...
...
c++/src/capnproto/layout.h
View file @
1a515be7
...
@@ -486,7 +486,7 @@ public:
...
@@ -486,7 +486,7 @@ public:
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
*
ELEMENTS
),
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
*
ELEMENTS
),
step
(
0
*
BITS
/
ELEMENTS
)
{}
step
(
0
*
BITS
/
ELEMENTS
)
{}
inline
ElementCount
size
();
inline
ElementCount
size
()
const
;
// The number of elements in the list.
// The number of elements in the list.
Text
::
Builder
asText
();
Text
::
Builder
asText
();
...
@@ -570,7 +570,7 @@ public:
...
@@ -570,7 +570,7 @@ public:
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
),
step
(
0
*
BITS
/
ELEMENTS
),
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
),
step
(
0
*
BITS
/
ELEMENTS
),
structDataSize
(
0
),
structReferenceCount
(
0
),
nestingLimit
(
0
)
{}
structDataSize
(
0
),
structReferenceCount
(
0
),
nestingLimit
(
0
)
{}
inline
ElementCount
size
();
inline
ElementCount
size
()
const
;
// The number of elements in the list.
// The number of elements in the list.
Text
::
Reader
asText
();
Text
::
Reader
asText
();
...
@@ -767,7 +767,7 @@ T StructReader::getDataField(ElementCount offset, Mask<T> mask) const {
...
@@ -767,7 +767,7 @@ T StructReader::getDataField(ElementCount offset, Mask<T> mask) const {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline
ElementCount
ListBuilder
::
size
()
{
return
elementCount
;
}
inline
ElementCount
ListBuilder
::
size
()
const
{
return
elementCount
;
}
template
<
typename
T
>
template
<
typename
T
>
inline
T
ListBuilder
::
getDataElement
(
ElementCount
index
)
const
{
inline
T
ListBuilder
::
getDataElement
(
ElementCount
index
)
const
{
...
@@ -814,7 +814,7 @@ inline void ListBuilder::setDataElement<Void>(ElementCount index, Void value) co
...
@@ -814,7 +814,7 @@ inline void ListBuilder::setDataElement<Void>(ElementCount index, Void value) co
// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline
ElementCount
ListReader
::
size
()
{
return
elementCount
;
}
inline
ElementCount
ListReader
::
size
()
const
{
return
elementCount
;
}
template
<
typename
T
>
template
<
typename
T
>
inline
T
ListReader
::
getDataElement
(
ElementCount
index
)
const
{
inline
T
ListReader
::
getDataElement
(
ElementCount
index
)
const
{
...
...
c++/src/capnproto/list.h
View file @
1a515be7
...
@@ -40,8 +40,13 @@ struct MaybeReaderBuilder<T, Kind::PRIMITIVE> {
...
@@ -40,8 +40,13 @@ struct MaybeReaderBuilder<T, Kind::PRIMITIVE> {
typedef
T
Reader
;
typedef
T
Reader
;
typedef
T
Builder
;
typedef
T
Builder
;
};
};
template
<
typename
T
>
struct
MaybeReaderBuilder
<
T
,
Kind
::
ENUM
>
{
typedef
T
Reader
;
typedef
T
Builder
;
};
template
<
typename
t
>
template
<
typename
T
,
Kind
k
=
kind
<
T
>
()
>
struct
PointerHelpers
;
struct
PointerHelpers
;
}
// namespace internal
}
// namespace internal
...
@@ -148,11 +153,12 @@ public:
...
@@ -148,11 +153,12 @@ public:
inline
bool
operator
>
(
const
IndexingIterator
&
other
)
const
{
return
index
>
other
.
index
;
}
inline
bool
operator
>
(
const
IndexingIterator
&
other
)
const
{
return
index
>
other
.
index
;
}
private
:
private
:
Container
*
container
;
const
Container
*
container
;
uint
index
;
uint
index
;
friend
Container
;
friend
Container
;
inline
IndexingIterator
(
Container
*
container
,
uint
index
)
:
container
(
container
),
index
(
index
)
{}
inline
IndexingIterator
(
const
Container
*
container
,
uint
index
)
:
container
(
container
),
index
(
index
)
{}
};
};
}
// namespace internal
}
// namespace internal
...
@@ -166,12 +172,14 @@ struct List<T, Kind::PRIMITIVE> {
...
@@ -166,12 +172,14 @@ struct List<T, Kind::PRIMITIVE> {
Reader
()
=
default
;
Reader
()
=
default
;
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
uint
size
()
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
T
operator
[](
uint
index
)
{
return
reader
.
template
getDataElement
<
T
>
(
index
*
ELEMENTS
);
}
inline
T
operator
[](
uint
index
)
const
{
return
reader
.
template
getDataElement
<
T
>
(
index
*
ELEMENTS
);
}
typedef
internal
::
IndexingIterator
<
Reader
,
T
>
iterator
;
typedef
internal
::
IndexingIterator
<
Reader
,
T
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
private
:
private
:
internal
::
ListReader
reader
;
internal
::
ListReader
reader
;
...
@@ -182,8 +190,8 @@ struct List<T, Kind::PRIMITIVE> {
...
@@ -182,8 +190,8 @@ struct List<T, Kind::PRIMITIVE> {
Builder
()
=
default
;
Builder
()
=
default
;
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
uint
size
()
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
T
operator
[](
uint
index
)
{
inline
T
operator
[](
uint
index
)
const
{
return
builder
.
template
getDataElement
<
T
>
(
index
*
ELEMENTS
);
return
builder
.
template
getDataElement
<
T
>
(
index
*
ELEMENTS
);
}
}
inline
void
set
(
uint
index
,
T
value
)
{
inline
void
set
(
uint
index
,
T
value
)
{
...
@@ -197,8 +205,8 @@ struct List<T, Kind::PRIMITIVE> {
...
@@ -197,8 +205,8 @@ struct List<T, Kind::PRIMITIVE> {
}
}
typedef
internal
::
IndexingIterator
<
Builder
,
T
>
iterator
;
typedef
internal
::
IndexingIterator
<
Builder
,
T
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
template
<
typename
Other
>
template
<
typename
Other
>
void
copyFrom
(
const
Other
&
other
)
{
void
copyFrom
(
const
Other
&
other
)
{
...
@@ -225,16 +233,16 @@ struct List<T, Kind::PRIMITIVE> {
...
@@ -225,16 +233,16 @@ struct List<T, Kind::PRIMITIVE> {
private
:
private
:
inline
static
internal
::
ListBuilder
initAsElementOf
(
inline
static
internal
::
ListBuilder
initAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
return
builder
.
initListElement
(
return
builder
.
initListElement
(
index
*
ELEMENTS
,
internal
::
FieldSizeForType
<
T
>::
value
,
size
*
ELEMENTS
);
index
*
ELEMENTS
,
internal
::
FieldSizeForType
<
T
>::
value
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsElementOf
(
inline
static
internal
::
ListBuilder
getAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
)
{
return
builder
.
getListElement
(
index
*
ELEMENTS
);
return
builder
.
getListElement
(
index
*
ELEMENTS
);
}
}
inline
static
internal
::
ListReader
getAsElementOf
(
inline
static
internal
::
ListReader
getAsElementOf
(
internal
::
ListReader
&
reader
,
uint
index
)
{
const
internal
::
ListReader
&
reader
,
uint
index
)
{
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSizeForType
<
T
>::
value
);
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSizeForType
<
T
>::
value
);
}
}
...
@@ -243,17 +251,17 @@ private:
...
@@ -243,17 +251,17 @@ private:
return
builder
.
initListField
(
index
,
internal
::
FieldSizeForType
<
T
>::
value
,
size
*
ELEMENTS
);
return
builder
.
initListField
(
index
,
internal
::
FieldSizeForType
<
T
>::
value
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsFieldOf
(
inline
static
internal
::
ListBuilder
getAsFieldOf
(
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
)
{
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
builder
.
getListField
(
index
,
nullptr
);
return
builder
.
getListField
(
index
,
defaultValue
);
}
}
inline
static
internal
::
ListReader
getAsFieldOf
(
inline
static
internal
::
ListReader
getAsFieldOf
(
internal
::
StructReader
&
reader
,
WireReferenceCount
index
)
{
internal
::
StructReader
&
reader
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
reader
.
getListField
(
index
,
internal
::
FieldSizeForType
<
T
>::
value
,
nullptr
);
return
reader
.
getListField
(
index
,
internal
::
FieldSizeForType
<
T
>::
value
,
defaultValue
);
}
}
template
<
typename
U
,
Kind
k
>
template
<
typename
U
,
Kind
k
>
friend
class
List
;
friend
class
List
;
template
<
typename
U
>
template
<
typename
U
,
Kind
K
>
friend
struct
internal
::
PointerHelpers
;
friend
struct
internal
::
PointerHelpers
;
};
};
...
@@ -269,14 +277,14 @@ struct List<T, Kind::STRUCT> {
...
@@ -269,14 +277,14 @@ struct List<T, Kind::STRUCT> {
Reader
()
=
default
;
Reader
()
=
default
;
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
uint
size
()
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
typename
T
::
Reader
operator
[](
uint
index
)
{
inline
typename
T
::
Reader
operator
[](
uint
index
)
const
{
return
typename
T
::
Reader
(
reader
.
getStructElement
(
index
*
ELEMENTS
));
return
typename
T
::
Reader
(
reader
.
getStructElement
(
index
*
ELEMENTS
));
}
}
typedef
internal
::
IndexingIterator
<
Reader
,
typename
T
::
Reader
>
iterator
;
typedef
internal
::
IndexingIterator
<
Reader
,
typename
T
::
Reader
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
private
:
private
:
internal
::
ListReader
reader
;
internal
::
ListReader
reader
;
...
@@ -287,15 +295,15 @@ struct List<T, Kind::STRUCT> {
...
@@ -287,15 +295,15 @@ struct List<T, Kind::STRUCT> {
Builder
()
=
default
;
Builder
()
=
default
;
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
uint
size
()
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
typename
T
::
Builder
operator
[](
uint
index
)
{
inline
typename
T
::
Builder
operator
[](
uint
index
)
const
{
return
typename
T
::
Builder
(
builder
.
getStructElement
(
return
typename
T
::
Builder
(
builder
.
getStructElement
(
index
*
ELEMENTS
,
internal
::
structSize
<
T
>
()));
index
*
ELEMENTS
,
internal
::
structSize
<
T
>
()));
}
}
typedef
internal
::
IndexingIterator
<
Builder
,
typename
T
::
Builder
>
iterator
;
typedef
internal
::
IndexingIterator
<
Builder
,
typename
T
::
Builder
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
template
<
typename
Other
>
template
<
typename
Other
>
void
copyFrom
(
const
Other
&
other
);
void
copyFrom
(
const
Other
&
other
);
...
@@ -308,16 +316,16 @@ struct List<T, Kind::STRUCT> {
...
@@ -308,16 +316,16 @@ struct List<T, Kind::STRUCT> {
private
:
private
:
inline
static
internal
::
ListBuilder
initAsElementOf
(
inline
static
internal
::
ListBuilder
initAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
return
builder
.
initStructListElement
(
return
builder
.
initStructListElement
(
index
*
ELEMENTS
,
size
*
ELEMENTS
,
internal
::
structSize
<
T
>
());
index
*
ELEMENTS
,
size
*
ELEMENTS
,
internal
::
structSize
<
T
>
());
}
}
inline
static
internal
::
ListBuilder
getAsElementOf
(
inline
static
internal
::
ListBuilder
getAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
)
{
return
builder
.
getListElement
(
index
*
ELEMENTS
);
return
builder
.
getListElement
(
index
*
ELEMENTS
);
}
}
inline
static
internal
::
ListReader
getAsElementOf
(
inline
static
internal
::
ListReader
getAsElementOf
(
internal
::
ListReader
&
reader
,
uint
index
)
{
const
internal
::
ListReader
&
reader
,
uint
index
)
{
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
INLINE_COMPOSITE
);
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
INLINE_COMPOSITE
);
}
}
...
@@ -326,17 +334,17 @@ private:
...
@@ -326,17 +334,17 @@ private:
return
builder
.
initStructListField
(
index
,
size
*
ELEMENTS
,
internal
::
structSize
<
T
>
());
return
builder
.
initStructListField
(
index
,
size
*
ELEMENTS
,
internal
::
structSize
<
T
>
());
}
}
inline
static
internal
::
ListBuilder
getAsFieldOf
(
inline
static
internal
::
ListBuilder
getAsFieldOf
(
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
)
{
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
builder
.
getListField
(
index
,
nullptr
);
return
builder
.
getListField
(
index
,
defaultValue
);
}
}
inline
static
internal
::
ListReader
getAsFieldOf
(
inline
static
internal
::
ListReader
getAsFieldOf
(
internal
::
StructReader
&
reader
,
WireReferenceCount
index
)
{
internal
::
StructReader
&
reader
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
INLINE_COMPOSITE
,
nullptr
);
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
INLINE_COMPOSITE
,
defaultValue
);
}
}
template
<
typename
U
,
Kind
k
>
template
<
typename
U
,
Kind
k
>
friend
class
List
;
friend
class
List
;
template
<
typename
U
>
template
<
typename
U
,
Kind
K
>
friend
struct
internal
::
PointerHelpers
;
friend
struct
internal
::
PointerHelpers
;
};
};
...
@@ -349,14 +357,14 @@ struct List<List<T>, Kind::LIST> {
...
@@ -349,14 +357,14 @@ struct List<List<T>, Kind::LIST> {
Reader
()
=
default
;
Reader
()
=
default
;
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
uint
size
()
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
typename
List
<
T
>::
Reader
operator
[](
uint
index
)
{
inline
typename
List
<
T
>::
Reader
operator
[](
uint
index
)
const
{
return
typename
List
<
T
>::
Reader
(
List
<
T
>::
getAsElementOf
(
reader
,
index
));
return
typename
List
<
T
>::
Reader
(
List
<
T
>::
getAsElementOf
(
reader
,
index
));
}
}
typedef
internal
::
IndexingIterator
<
Reader
,
typename
List
<
T
>::
Reader
>
iterator
;
typedef
internal
::
IndexingIterator
<
Reader
,
typename
List
<
T
>::
Reader
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
private
:
private
:
internal
::
ListReader
reader
;
internal
::
ListReader
reader
;
...
@@ -367,8 +375,8 @@ struct List<List<T>, Kind::LIST> {
...
@@ -367,8 +375,8 @@ struct List<List<T>, Kind::LIST> {
Builder
()
=
default
;
Builder
()
=
default
;
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
uint
size
()
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
typename
List
<
T
>::
Builder
operator
[](
uint
index
)
{
inline
typename
List
<
T
>::
Builder
operator
[](
uint
index
)
const
{
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
getAsElementOf
(
builder
,
index
));
return
typename
List
<
T
>::
Builder
(
List
<
T
>::
getAsElementOf
(
builder
,
index
));
}
}
inline
typename
List
<
T
>::
Builder
init
(
uint
index
,
uint
size
)
{
inline
typename
List
<
T
>::
Builder
init
(
uint
index
,
uint
size
)
{
...
@@ -376,8 +384,8 @@ struct List<List<T>, Kind::LIST> {
...
@@ -376,8 +384,8 @@ struct List<List<T>, Kind::LIST> {
}
}
typedef
internal
::
IndexingIterator
<
Builder
,
typename
List
<
T
>::
Builder
>
iterator
;
typedef
internal
::
IndexingIterator
<
Builder
,
typename
List
<
T
>::
Builder
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
template
<
typename
Other
>
template
<
typename
Other
>
void
copyFrom
(
const
Other
&
other
);
void
copyFrom
(
const
Other
&
other
);
...
@@ -390,16 +398,16 @@ struct List<List<T>, Kind::LIST> {
...
@@ -390,16 +398,16 @@ struct List<List<T>, Kind::LIST> {
private
:
private
:
inline
static
internal
::
ListBuilder
initAsElementOf
(
inline
static
internal
::
ListBuilder
initAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
return
builder
.
initListElement
(
return
builder
.
initListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsElementOf
(
inline
static
internal
::
ListBuilder
getAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
)
{
return
builder
.
getListElement
(
index
*
ELEMENTS
);
return
builder
.
getListElement
(
index
*
ELEMENTS
);
}
}
inline
static
internal
::
ListReader
getAsElementOf
(
inline
static
internal
::
ListReader
getAsElementOf
(
internal
::
ListReader
&
reader
,
uint
index
)
{
const
internal
::
ListReader
&
reader
,
uint
index
)
{
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
);
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
);
}
}
...
@@ -408,17 +416,17 @@ private:
...
@@ -408,17 +416,17 @@ private:
return
builder
.
initListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
return
builder
.
initListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsFieldOf
(
inline
static
internal
::
ListBuilder
getAsFieldOf
(
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
)
{
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
builder
.
getListField
(
index
,
nullptr
);
return
builder
.
getListField
(
index
,
defaultValue
);
}
}
inline
static
internal
::
ListReader
getAsFieldOf
(
inline
static
internal
::
ListReader
getAsFieldOf
(
internal
::
StructReader
&
reader
,
WireReferenceCount
index
)
{
internal
::
StructReader
&
reader
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
nullptr
);
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
defaultValue
);
}
}
template
<
typename
U
,
Kind
k
>
template
<
typename
U
,
Kind
k
>
friend
class
List
;
friend
class
List
;
template
<
typename
U
>
template
<
typename
U
,
Kind
K
>
friend
struct
internal
::
PointerHelpers
;
friend
struct
internal
::
PointerHelpers
;
};
};
...
@@ -429,14 +437,14 @@ struct List<T, Kind::BLOB> {
...
@@ -429,14 +437,14 @@ struct List<T, Kind::BLOB> {
Reader
()
=
default
;
Reader
()
=
default
;
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
explicit
Reader
(
internal
::
ListReader
reader
)
:
reader
(
reader
)
{}
inline
uint
size
()
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
reader
.
size
()
/
ELEMENTS
;
}
inline
typename
T
::
Reader
operator
[](
uint
index
)
{
inline
typename
T
::
Reader
operator
[](
uint
index
)
const
{
return
reader
.
getBlobElement
<
T
>
(
index
*
ELEMENTS
);
return
reader
.
getBlobElement
<
T
>
(
index
*
ELEMENTS
);
}
}
typedef
internal
::
IndexingIterator
<
Reader
,
typename
T
::
Reader
>
iterator
;
typedef
internal
::
IndexingIterator
<
Reader
,
typename
T
::
Reader
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
private
:
private
:
internal
::
ListReader
reader
;
internal
::
ListReader
reader
;
...
@@ -447,8 +455,8 @@ struct List<T, Kind::BLOB> {
...
@@ -447,8 +455,8 @@ struct List<T, Kind::BLOB> {
Builder
()
=
default
;
Builder
()
=
default
;
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
explicit
Builder
(
internal
::
ListBuilder
builder
)
:
builder
(
builder
)
{}
inline
uint
size
()
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
uint
size
()
const
{
return
builder
.
size
()
/
ELEMENTS
;
}
inline
typename
T
::
Builder
operator
[](
uint
index
)
{
inline
typename
T
::
Builder
operator
[](
uint
index
)
const
{
return
builder
.
getBlobElement
<
T
>
(
index
*
ELEMENTS
);
return
builder
.
getBlobElement
<
T
>
(
index
*
ELEMENTS
);
}
}
inline
void
set
(
uint
index
,
typename
T
::
Reader
value
)
{
inline
void
set
(
uint
index
,
typename
T
::
Reader
value
)
{
...
@@ -459,8 +467,8 @@ struct List<T, Kind::BLOB> {
...
@@ -459,8 +467,8 @@ struct List<T, Kind::BLOB> {
}
}
typedef
internal
::
IndexingIterator
<
Builder
,
typename
T
::
Builder
>
iterator
;
typedef
internal
::
IndexingIterator
<
Builder
,
typename
T
::
Builder
>
iterator
;
inline
iterator
begin
()
{
return
iterator
(
this
,
0
);
}
inline
iterator
begin
()
const
{
return
iterator
(
this
,
0
);
}
inline
iterator
end
()
{
return
iterator
(
this
,
size
());
}
inline
iterator
end
()
const
{
return
iterator
(
this
,
size
());
}
template
<
typename
Other
>
template
<
typename
Other
>
void
copyFrom
(
const
Other
&
other
)
{
void
copyFrom
(
const
Other
&
other
)
{
...
@@ -487,16 +495,16 @@ struct List<T, Kind::BLOB> {
...
@@ -487,16 +495,16 @@ struct List<T, Kind::BLOB> {
private
:
private
:
inline
static
internal
::
ListBuilder
initAsElementOf
(
inline
static
internal
::
ListBuilder
initAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
,
uint
size
)
{
return
builder
.
initListElement
(
return
builder
.
initListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsElementOf
(
inline
static
internal
::
ListBuilder
getAsElementOf
(
internal
::
ListBuilder
&
builder
,
uint
index
)
{
const
internal
::
ListBuilder
&
builder
,
uint
index
)
{
return
builder
.
getListElement
(
index
*
ELEMENTS
);
return
builder
.
getListElement
(
index
*
ELEMENTS
);
}
}
inline
static
internal
::
ListReader
getAsElementOf
(
inline
static
internal
::
ListReader
getAsElementOf
(
internal
::
ListReader
&
reader
,
uint
index
)
{
const
internal
::
ListReader
&
reader
,
uint
index
)
{
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
);
return
reader
.
getListElement
(
index
*
ELEMENTS
,
internal
::
FieldSize
::
REFERENCE
);
}
}
...
@@ -505,17 +513,17 @@ private:
...
@@ -505,17 +513,17 @@ private:
return
builder
.
initListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
return
builder
.
initListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
size
*
ELEMENTS
);
}
}
inline
static
internal
::
ListBuilder
getAsFieldOf
(
inline
static
internal
::
ListBuilder
getAsFieldOf
(
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
)
{
internal
::
StructBuilder
&
builder
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
builder
.
getListField
(
index
,
nullptr
);
return
builder
.
getListField
(
index
,
defaultValue
);
}
}
inline
static
internal
::
ListReader
getAsFieldOf
(
inline
static
internal
::
ListReader
getAsFieldOf
(
internal
::
StructReader
&
reader
,
WireReferenceCount
index
)
{
internal
::
StructReader
&
reader
,
WireReferenceCount
index
,
const
word
*
defaultValue
)
{
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
nullptr
);
return
reader
.
getListField
(
index
,
internal
::
FieldSize
::
REFERENCE
,
defaultValue
);
}
}
template
<
typename
U
,
Kind
k
>
template
<
typename
U
,
Kind
k
>
friend
class
List
;
friend
class
List
;
template
<
typename
U
>
template
<
typename
U
,
Kind
K
>
friend
struct
internal
::
PointerHelpers
;
friend
struct
internal
::
PointerHelpers
;
};
};
...
...
compiler/src/CxxGenerator.hs
View file @
1a515be7
...
@@ -287,6 +287,9 @@ fieldContext parent desc = mkStrContext context where
...
@@ -287,6 +287,9 @@ fieldContext parent desc = mkStrContext context where
context
"fieldTitleCase"
=
MuVariable
$
toTitleCase
$
fieldName
desc
context
"fieldTitleCase"
=
MuVariable
$
toTitleCase
$
fieldName
desc
context
"fieldUpperCase"
=
MuVariable
$
toUpperCaseWithUnderscores
$
fieldName
desc
context
"fieldUpperCase"
=
MuVariable
$
toUpperCaseWithUnderscores
$
fieldName
desc
context
"fieldIsPrimitive"
=
MuBool
$
isPrimitive
$
fieldType
desc
context
"fieldIsPrimitive"
=
MuBool
$
isPrimitive
$
fieldType
desc
context
"fieldIsListOrBlob"
=
MuBool
$
isBlob
(
fieldType
desc
)
||
isList
(
fieldType
desc
)
context
"fieldIsBlob"
=
MuBool
$
isBlob
$
fieldType
desc
context
"fieldIsBlob"
=
MuBool
$
isBlob
$
fieldType
desc
context
"fieldIsInlineBlob"
=
MuBool
$
isInlineBlob
$
fieldType
desc
context
"fieldIsInlineBlob"
=
MuBool
$
isInlineBlob
$
fieldType
desc
context
"fieldIsStruct"
=
MuBool
$
isStruct
$
fieldType
desc
context
"fieldIsStruct"
=
MuBool
$
isStruct
$
fieldType
desc
...
@@ -332,6 +335,11 @@ fieldContext parent desc = mkStrContext context where
...
@@ -332,6 +335,11 @@ fieldContext parent desc = mkStrContext context where
MuVariable
$
cxxFieldSizeString
$
fieldSize
$
inlineElementType
$
fieldType
desc
MuVariable
$
cxxFieldSizeString
$
fieldSize
$
inlineElementType
$
fieldType
desc
context
"fieldElementType"
=
context
"fieldElementType"
=
MuVariable
$
cxxTypeString
$
elementType
$
fieldType
desc
MuVariable
$
cxxTypeString
$
elementType
$
fieldType
desc
context
"fieldElementReaderType"
=
MuVariable
readerString
where
readerString
=
if
isPrimitiveList
$
fieldType
desc
then
tString
else
tString
++
"::Reader"
tString
=
cxxTypeString
$
elementType
$
fieldType
desc
context
"fieldInlineElementType"
=
context
"fieldInlineElementType"
=
MuVariable
$
cxxTypeString
$
inlineElementType
$
fieldType
desc
MuVariable
$
cxxTypeString
$
inlineElementType
$
fieldType
desc
context
"fieldUnion"
=
case
fieldUnion
desc
of
context
"fieldUnion"
=
case
fieldUnion
desc
of
...
...
compiler/src/c++-header.mustache
View file @
1a515be7
...
@@ -148,15 +148,11 @@ public:
...
@@ -148,15 +148,11 @@ public:
{{#
fieldIsPrimitive
}}
{{#
fieldIsPrimitive
}}
inline
{{
fieldType
}}
get
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
get
{{
fieldTitleCase
}}
();
{{/
fieldIsPrimitive
}}
{{/
fieldIsPrimitive
}}
{{#
fieldIsBlob
}}
{{^
fieldIsPrimitive
}}
{{^
fieldIsGenericObject
}}
inline
{{
fieldType
}}
::Reader get
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
::Reader get
{{
fieldTitleCase
}}
();
{{/
fieldIsBlob
}}
{{/
fieldIsGenericObject
}}
{{#
fieldIsStruct
}}
{{/
fieldIsPrimitive
}}
inline
{{
fieldType
}}
::Reader get
{{
fieldTitleCase
}}
();
{{/
fieldIsStruct
}}
{{#
fieldIsList
}}
inline
{{
fieldType
}}
::Reader get
{{
fieldTitleCase
}}
();
{{/
fieldIsList
}}
{{#
fieldIsGenericObject
}}
{{#
fieldIsGenericObject
}}
template
<typename
T
>
inline typename T::Reader get
{{
fieldTitleCase
}}
();
template
<typename
T
>
inline typename T::Reader get
{{
fieldTitleCase
}}
();
{{/
fieldIsGenericObject
}}
{{/
fieldIsGenericObject
}}
...
@@ -190,35 +186,25 @@ public:
...
@@ -190,35 +186,25 @@ public:
inline
{{
fieldType
}}
get
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
get
{{
fieldTitleCase
}}
();
inline void set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
value);
inline void set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
value);
{{/
fieldIsPrimitive
}}
{{/
fieldIsPrimitive
}}
{{#
fieldIsBlob
}}
{{^
fieldIsPrimitive
}}
{{^
fieldIsGenericObject
}}
inline
{{
fieldType
}}
::Builder get
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
::Builder get
{{
fieldTitleCase
}}
();
inline void set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
::Reader value);
inline void set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
::Reader other);
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
(
{{^
fieldIsInlineBlob
}}
unsigned int size
{{/
fieldIsInlineBlob
}}
);
{{#
fieldIsList
}}
{{/
fieldIsBlob
}}
inline void set
{{
fieldTitleCase
}}
(
std::initializer_list
<
{{
fieldElementReaderType
}}
>
other);
{{/
fieldIsList
}}
{{#
fieldIsListOrBlob
}}
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
(unsigned int size);
{{/
fieldIsListOrBlob
}}
{{#
fieldIsStruct
}}
{{#
fieldIsStruct
}}
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
();
inline
{{
fieldType
}}
::Builder get
{{
fieldTitleCase
}}
();
{{/
fieldIsStruct
}}
{{/
fieldIsStruct
}}
{{#
fieldIsList
}}
{{/
fieldIsGenericObject
}}
{{#
fieldIsInlineList
}}
{{/
fieldIsPrimitive
}}
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
();
{{/
fieldIsInlineList
}}
{{^
fieldIsInlineList
}}
inline
{{
fieldType
}}
::Builder init
{{
fieldTitleCase
}}
(unsigned int size);
{{/
fieldIsInlineList
}}
inline
{{
fieldType
}}
::Builder get
{{
fieldTitleCase
}}
();
template
<typename
_t
>
inline void set
{{
fieldTitleCase
}}
(const _t
&
other);
{{#
fieldIsPrimitiveList
}}
inline void set
{{
fieldTitleCase
}}
(std::initializer_list
<
{{
fieldElementType
}}
>
other);
{{/
fieldIsPrimitiveList
}}
{{^
fieldIsPrimitiveList
}}
inline void set
{{
fieldTitleCase
}}
(std::initializer_list
<
{{
fieldElementType
}}
::Reader>
other);
{{/
fieldIsPrimitiveList
}}
{{/
fieldIsList
}}
{{#
fieldIsGenericObject
}}
{{#
fieldIsGenericObject
}}
template
<typename
T
>
inline typename T::Builder get
{{
fieldTitleCase
}}
();
template
<typename
T
>
inline typename T::Builder get
{{
fieldTitleCase
}}
();
template
<typename
T
>
inline void set
{{
fieldTitleCase
}}
(
const typename T::Reader
&
value);
template
<typename
T
>
inline void set
{{
fieldTitleCase
}}
(
typename T::Reader
value);
template
<typename
T
>
inline typename T::Builder init
{{
fieldTitleCase
}}
();
template
<typename
T
>
inline typename T::Builder init
{{
fieldTitleCase
}}
();
template
<typename
T
>
inline typename T::Builder init
{{
fieldTitleCase
}}
(unsigned int size);
template
<typename
T
>
inline typename T::Builder init
{{
fieldTitleCase
}}
(unsigned int size);
{{/
fieldIsGenericObject
}}
{{/
fieldIsGenericObject
}}
...
@@ -282,21 +268,21 @@ inline void {{typeFullName}}::Builder::set{{fieldTitleCase}}({{fieldType}} value
...
@@ -282,21 +268,21 @@ inline void {{typeFullName}}::Builder::set{{fieldTitleCase}}({{fieldType}} value
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
_builder.setDataField
<
{{
fieldType
}}
>
(
_builder.setDataField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::ELEMENTS, value
{{
fieldDefaultMask
}}
);
{{
fieldOffset
}}
* ::capnproto::ELEMENTS, value
{{
fieldDefaultMask
}}
);
}
}
{{/
fieldIsPrimitive
}}
{{/
fieldIsPrimitive
}}
{{! ------------------------------------------------------------------------------------------- }}
{{! ------------------------------------------------------------------------------------------- }}
{{
#
fieldIsBlob
}}
{{
^
fieldIsGenericObject
}}
{{
#
fieldIsInlineBlob
}}
{{
^
fieldIsPrimitive
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
_reader.getInlineBlobField
<
{{
fieldType
}}
>
(
return
::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::get
(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES
,
_reader,
{{
fieldOffset
}}
* ::capnproto::REFERENCES
{{#
fieldDefaultBytes
}}
,
{{
fieldInlineListSize
}}
* ::capnproto::BYTES
);
DEFAULT_
{{
fieldUpperCase
}}
.words
{{#
fieldIsBlob
}}
,
{{
defaultBlobSize
}}{{/
fieldIsBlob
}}{{/
fieldDefaultBytes
}}
);
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
...
@@ -304,400 +290,104 @@ inline {{fieldType}}::Builder {{typeFullName}}::Builder::get{{fieldTitleCase}}()
...
@@ -304,400 +290,104 @@ inline {{fieldType}}::Builder {{typeFullName}}::Builder::get{{fieldTitleCase}}()
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return _builder.getInlineBlobField
<
{{
fieldType
}}
>
(
return ::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::get(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES
{{#
fieldDefaultBytes
}}
,
{{
fieldInlineListSize
}}
* ::capnproto::BYTES);
DEFAULT_
{{
fieldUpperCase
}}
.words
{{#
fieldIsBlob
}}
,
{{
defaultBlobSize
}}{{/
fieldIsBlob
}}{{/
fieldDefaultBytes
}}
);
}
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
::Reader value) {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
_builder.setInlineBlobField
<
{{
fieldType
}}
>
(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlineListSize
}}
* ::capnproto::BYTES,
value);
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return _builder.initInlineBlobField
<
{{
fieldType
}}
>
(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlineListSize
}}
* ::capnproto::BYTES);
}
{{/
fieldIsInlineBlob
}}
{{^
fieldIsInlineBlob
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return _reader.getBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words,
{{
defaultBlobSize
}}
* ::capnproto::BYTES
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr, 0 * ::capnproto::BYTES
{{/
fieldDefaultBytes
}}
);
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return _builder.getBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words,
{{
defaultBlobSize
}}
* ::capnproto::BYTES
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr, 0 * ::capnproto::BYTES
{{/
fieldDefaultBytes
}}
);
}
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
::Reader value) {
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
{{
fieldType
}}
::Reader value) {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
_builder.setBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES, value);
::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::set(
}
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, value);
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return _builder.initBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES, size * ::capnproto::BYTES);
}
{{/
fieldIsInlineBlob
}}
{{/
fieldIsBlob
}}
{{! ------------------------------------------------------------------------------------------- }}
{{#
fieldIsStruct
}}
{{^
fieldIsInlineStruct
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getStructField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initStructField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
::capnproto::internal::structSize
<
{{
fieldType
}}
>
()));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getStructField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
::capnproto::internal::structSize
<
{{
fieldType
}}
>
(),
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
{{/
fieldIsInlineStruct
}}
{{#
fieldIsInlineStruct
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getInlineStructField(
{{
fieldOffset
}}
));
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initInlineStructField(
{{
fieldOffset
}}
));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getInlineStructField(
{{
fieldOffset
}}
));
}
{{/
fieldIsInlineStruct
}}
{{/
fieldIsStruct
}}
{{! ------------------------------------------------------------------------------------------- }}
{{#
fieldIsList
}}
{{#
fieldIsList
}}
{{#
fieldIsInlineList
}}
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
{{#
fieldIsPrimitiveList
}}
std::initializer_list
<
{{
fieldElementReaderType
}}
>
value) {
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getInlineDataListField(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::FieldSize::
{{
fieldElementSize
}}
));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initInlineDataListField(
::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::set(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, value);
{{
fieldInlineDataSize
}}
* ::capnproto::BYTES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::FieldSize::
{{
fieldElementSize
}}
));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getInlineDataListField(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::FieldSize::
{{
fieldElementSize
}}
));
}
{{/
fieldIsPrimitiveList
}}
{{#
fieldIsPointerList
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getInlinePointerListField(
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS));
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{/
fieldIsList
}}
{{#
fieldIsListOrBlob
}}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initInlinePointerListField(
return ::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::init(
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, size);
{{
fieldInlinePointerSize
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getInlinePointerListField(
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS));
}
{{/
fieldIsPointerList
}}
{{#
fieldIsStructList
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getInlineStructListField(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::structSize
<
{{
fieldInlineElementType
}}
>
()));
}
}
{{/
fieldIsListOrBlob
}}
{{#
fieldIsStruct
}}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initInlineStructListField(
return ::capnproto::internal::PointerHelpers
<
{{
fieldType
}}
>
::init(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::structSize
<
{{
fieldInlineElementType
}}
>
()));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getInlineStructListField(
{{
fieldInlineDataOffset
}}
* ::capnproto::BYTES,
{{
fieldInlinePointerOffset
}}
* ::capnproto::REFERENCES,
{{
fieldInlineListSize
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::structSize
<
{{
fieldInlineElementType
}}
>
()));
}
{{/
fieldIsStructList
}}
{{/
fieldIsInlineList
}}
{{! --------------------------------- }}
{{^
fieldIsInlineList
}}
{{^
fieldIsStructList
}}
{{^
fieldIsInlineBlobList
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getListField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
::capnproto::internal::FieldSize::
{{
fieldElementSize
}}
,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
{{/
fieldIsStruct
}}
{{#
fieldUnion
}}
{{/
fieldIsPrimitive
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{/
fieldIsGenericObject
}}
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{! ------------------------------------------------------------------------------------------- }}
{{/
fieldUnion
}}
{{#
fieldIsGenericObject
}}
return
{{
fieldType
}}
::Builder(_builder.initListField(
template
<typename
T
>
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
inline typename T::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
::capnproto::internal::FieldSize::
{{
fieldElementSize
}}
,
size
{{
fieldInlineMultiplier
}}
* ::capnproto::ELEMENTS));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getListField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
{{/
fieldIsInlineBlobList
}}
{{/
fieldIsStructList
}}
{{#
fieldIsInlineBlobList
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getBlobField
<
{{
fieldType
}}
>
(
return
::capnproto::internal::PointerHelpers
<T>
::get
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES, nullptr, 0 * ::capnproto::BYTES)
);
_reader,
{{
fieldOffset
}}
* ::capnproto::REFERENCES
);
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
template
<typename
T
>
{{#
fieldUnion
}}
inline typename T::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
size
{{
fieldInlineMultiplier
}}
* ::capnproto::BYTES));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getBlobField
<
{{
fieldType
}}
>
(
{{
fieldOffset
}}
* ::capnproto::REFERENCES, nullptr, 0 * ::capnproto::BYTES));
}
{{/
fieldIsInlineBlobList
}}
{{#
fieldIsStructList
}}
inline
{{
fieldType
}}
::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Reader(_reader.getListField(
return ::capnproto::internal::PointerHelpers
<T>
::get(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
::capnproto::internal::FieldSize::INLINE_COMPOSITE,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
template
<typename
T
>
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(typename T::Reader value) {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.initStructListField(
::capnproto::internal::PointerHelpers
<T>
::set(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, value);
size
{{
fieldInlineMultiplier
}}
* ::capnproto::ELEMENTS,
::capnproto::internal::structSize
<
{{
fieldInlineElementType
}}
>
()));
}
inline
{{
fieldType
}}
::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
CAPNPROTO_INLINE_DPRECOND(which() ==
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
,
"Must check which() before get()ing a union member.");
{{/
fieldUnion
}}
return
{{
fieldType
}}
::Builder(_builder.getListField(
{{
fieldOffset
}}
* ::capnproto::REFERENCES,
{{#
fieldDefaultBytes
}}
DEFAULT_
{{
fieldUpperCase
}}
.words
{{/
fieldDefaultBytes
}}
{{^
fieldDefaultBytes
}}
nullptr
{{/
fieldDefaultBytes
}}
));
}
}
{{/
fieldIsStructList
}}
{{/
fieldIsInlineList
}}
{{! --------------------------------- }}
template
<typename
_t
>
template
<typename
T
>
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(const _t
&
other) {
inline typename T::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
init
{{
fieldTitleCase
}}
(
{{^
fieldIsInlineList
}}
other.size()
{{/
fieldIsInlineList
}}
).copyFrom(other);
}
{{#
fieldIsPrimitiveList
}}
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
std::initializer_list
<
{{
fieldElementType
}}
>
other) {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
init
{{
fieldTitleCase
}}
(
{{^
fieldIsInlineList
}}
other.size()
{{/
fieldIsInlineList
}}
).copyFrom(other);
}
{{/
fieldIsPrimitiveList
}}
{{^
fieldIsPrimitiveList
}}
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(
std::initializer_list
<
{{
fieldElementType
}}
::Reader>
other) {
{{#
fieldUnion
}}
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
{{/
fieldUnion
}}
init
{{
fieldTitleCase
}}
(
{{^
fieldIsInlineList
}}
other.size()
{{/
fieldIsInlineList
}}
).copyFrom(other);
}
{{/
fieldIsPrimitiveList
}}
{{/
fieldIsList
}}
{{! ------------------------------------------------------------------------------------------- }}
{{#
fieldIsGenericObject
}}
template
<typename
T
>
inline typename T::Reader
{{
typeFullName
}}
::Reader::get
{{
fieldTitleCase
}}
() {
return ::capnproto::internal::PointerHelpers
<T>
::get(
_reader,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
}
template
<typename
T
>
inline typename T::Builder
{{
typeFullName
}}
::Builder::get
{{
fieldTitleCase
}}
() {
return ::capnproto::internal::PointerHelpers
<T>
::get(
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
}
template
<typename
T
>
inline void
{{
typeFullName
}}
::Builder::set
{{
fieldTitleCase
}}
(const typename T::Reader
&
value) {
return ::capnproto::internal::PointerHelpers
<T>
::set(
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, value);
}
template
<typename
T
>
inline typename T::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
() {
return ::capnproto::internal::PointerHelpers
<T>
::init(
return ::capnproto::internal::PointerHelpers
<T>
::init(
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES);
}
}
template
<typename
T
>
template
<typename
T
>
inline typename T::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
inline typename T::Builder
{{
typeFullName
}}
::Builder::init
{{
fieldTitleCase
}}
(unsigned int size) {
{{#
fieldUnion
}}
_builder.setDataField
<
{{
unionTitleCase
}}
::Which>
(
{{
unionTagOffset
}}
* ::capnproto::ELEMENTS,
{{
unionTitleCase
}}
::
{{
fieldUpperCase
}}
);
{{/
fieldUnion
}}
return ::capnproto::internal::PointerHelpers
<T>
::init(
return ::capnproto::internal::PointerHelpers
<T>
::init(
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, size);
_builder,
{{
fieldOffset
}}
* ::capnproto::REFERENCES, size);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment