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
18cfa132
Commit
18cfa132
authored
May 10, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamic API WIP.
parent
1a515be7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
6 deletions
+23
-6
dynamic.c++
c++/src/capnproto/dynamic.c++
+0
-0
dynamic.h
c++/src/capnproto/dynamic.h
+0
-0
generated-header-support.h
c++/src/capnproto/generated-header-support.h
+16
-3
CxxGenerator.hs
compiler/src/CxxGenerator.hs
+2
-0
c++-header.mustache
compiler/src/c++-header.mustache
+5
-3
No files found.
c++/src/capnproto/dynamic.c++
0 → 100644
View file @
18cfa132
This diff is collapsed.
Click to expand it.
c++/src/capnproto/dynamic.h
0 → 100644
View file @
18cfa132
This diff is collapsed.
Click to expand it.
c++/src/capnproto/generated-header-support.h
View file @
18cfa132
...
...
@@ -33,6 +33,11 @@ namespace capnproto {
class
DynamicStruct
;
// So that it can be declared a friend.
template
<
typename
T
>
inline
constexpr
uint64_t
typeId
();
// typeId<MyType>() returns the type ID as defined in the schema. Works with structs, enums, and
// interfaces.
namespace
internal
{
template
<
typename
T
>
...
...
@@ -118,18 +123,26 @@ struct PointerHelpers<TrustedMessage> {
#endif
struct
RawSchema
{
const
word
*
encodedNode
;
const
RawSchema
*
dependencies
;
};
template
<
typename
T
>
inline
constexpr
const
RawSchema
&
rawSchema
();
}
// namespace internal
}
// namespace capnproto
#define CAPNPROTO_DECLARE_ENUM(type) \
#define CAPNPROTO_DECLARE_ENUM(type
, id
) \
template <> struct KindOf<type> { static constexpr Kind kind = Kind::ENUM; }
#define CAPNPROTO_DECLARE_STRUCT(type, dataWordSize, pointerCount, preferredElementEncoding) \
#define CAPNPROTO_DECLARE_STRUCT(type,
id,
dataWordSize, pointerCount, preferredElementEncoding) \
template <> struct KindOf<type> { static constexpr Kind kind = Kind::STRUCT; }; \
template <> struct StructSizeFor<type> { \
static constexpr StructSize value = StructSize( \
dataWordSize * WORDS, pointerCount * REFERENCES, FieldSize::preferredElementEncoding); \
}
#define CAPNPROTO_DECLARE_INTERFACE(type) \
#define CAPNPROTO_DECLARE_INTERFACE(type
, id
) \
template <> struct KindOf<type> { static constexpr Kind kind = Kind::INTERFACE; }
#endif // CAPNPROTO_GENERATED_HEADER_SUPPORT_H_
compiler/src/CxxGenerator.hs
View file @
18cfa132
...
...
@@ -265,6 +265,7 @@ enumerantContext parent desc = mkStrContext context where
enumContext
parent
desc
=
mkStrContext
context
where
context
"enumName"
=
MuVariable
$
enumName
desc
context
"enumId"
=
MuVariable
(
printf
"0x%16x"
(
enumId
desc
)
::
String
)
context
"enumerants"
=
MuList
$
map
(
enumerantContext
context
)
$
enumerants
desc
context
s
=
parent
s
...
...
@@ -383,6 +384,7 @@ structContext parent desc = mkStrContext context where
context
"typeFields"
=
context
"structFields"
context
"structName"
=
MuVariable
$
structName
desc
context
"structId"
=
MuVariable
(
printf
"0x%16x"
(
structId
desc
)
::
String
)
context
"structFullName"
=
MuVariable
$
fullName
(
DescStruct
desc
)
context
"structFields"
=
MuList
$
map
(
fieldContext
context
)
$
structFields
desc
context
"structUnions"
=
MuList
$
map
(
unionContext
context
)
$
structUnions
desc
...
...
compiler/src/c++-header.mustache
View file @
18cfa132
...
...
@@ -105,16 +105,18 @@ namespace internal {
{{#
typeStructOrUnion
}}
{{#
typeStruct
}}
CAPNPROTO_DECLARE_STRUCT(
::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
typeFullName
}}
,
::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
typeFullName
}}
,
{{
structId
}}
,
{{
structDataSize
}}
,
{{
structReferenceCount
}}
,
{{
structPreferredListEncoding
}}
);
{{#
structNestedEnums
}}
CAPNPROTO_DECLARE_ENUM(::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
typeFullName
}}
::
{{
enumName
}}
);
CAPNPROTO_DECLARE_ENUM(
::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
typeFullName
}}
::
{{
enumName
}}
,
{{
enumId
}}
);
{{/
structNestedEnums
}}
{{/
typeStruct
}}
{{/
typeStructOrUnion
}}
{{/
fileTypes
}}
{{#
fileEnums
}}
CAPNPROTO_DECLARE_ENUM(::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
enumName
}}
);
CAPNPROTO_DECLARE_ENUM(
::
{{#
fileNamespaces
}}{{
namespaceName
}}
::
{{/
fileNamespaces
}}{{
enumName
}}
,
{{
enumId
}}
);
{{/
fileEnums
}}
} // namespace capnproto
} // namespace internal
...
...
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