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
08a6b91f
Commit
08a6b91f
authored
Dec 12, 2016
by
Harris Hancock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert brand-pointer to constexpr-function (3/3)
parent
1633318a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
capability.c++
c++/src/capnp/capability.c++
+0
-3
capability.h
c++/src/capnp/capability.h
+3
-5
generated-header-support.h
c++/src/capnp/generated-header-support.h
+5
-5
No files found.
c++/src/capnp/capability.c++
View file @
08a6b91f
...
...
@@ -32,9 +32,6 @@
namespace
capnp
{
const
_
::
RawBrandedSchema
*
const
Capability
::
_capnpPrivate
::
brand
=
&
_
::
NULL_INTERFACE_SCHEMA
.
defaultBrand
;
namespace
_
{
void
setGlobalBrokenCapFactoryForLayoutCpp
(
BrokenCapFactory
&
factory
);
...
...
c++/src/capnp/capability.h
View file @
08a6b91f
...
...
@@ -82,11 +82,9 @@ struct Capability {
static
constexpr
Kind
kind
=
Kind
::
INTERFACE
;
static
constexpr
_
::
RawSchema
const
*
schema
=
&
_
::
NULL_INTERFACE_SCHEMA
;
static
const
_
::
RawBrandedSchema
*
const
brand
;
// Can't quite declare this one inline without including generated-header-support.h. Avoiding
// for now by declaring out-of-line.
// TODO(cleanup): Split RawSchema stuff into its own header that can be included here, or
// something.
static
const
_
::
RawBrandedSchema
*
brand
()
{
return
&
_
::
NULL_INTERFACE_SCHEMA
.
defaultBrand
;
}
};
};
...
...
c++/src/capnp/generated-header-support.h
View file @
08a6b91f
...
...
@@ -63,7 +63,7 @@ inline const RawSchema& rawSchema() {
template
<
typename
T
,
typename
CapnpPrivate
=
typename
T
::
_capnpPrivate
>
inline
const
RawBrandedSchema
&
rawBrandedSchema
()
{
return
*
CapnpPrivate
::
brand
;
return
*
CapnpPrivate
::
brand
()
;
}
template
<
typename
T
,
uint64_t
id
=
schemas
::
EnumInfo
<
T
>::
typeId
>
inline
const
RawBrandedSchema
&
rawBrandedSchema
()
{
...
...
@@ -78,7 +78,7 @@ struct ChooseBrand;
template
<
typename
TypeTag
>
struct
ChooseBrand
<
TypeTag
>
{
// All params were AnyPointer. No specific brand needed.
static
constexpr
_
::
RawBrandedSchema
const
*
brand
=
&
TypeTag
::
schema
->
defaultBrand
;
static
constexpr
_
::
RawBrandedSchema
const
*
brand
()
{
return
&
TypeTag
::
schema
->
defaultBrand
;
}
};
template
<
typename
TypeTag
,
typename
...
Rest
>
...
...
@@ -88,7 +88,7 @@ struct ChooseBrand<TypeTag, AnyPointer, Rest...>: public ChooseBrand<TypeTag, Re
template
<
typename
TypeTag
,
typename
First
,
typename
...
Rest
>
struct
ChooseBrand
<
TypeTag
,
First
,
Rest
...
>
{
// At least one parameter is not AnyPointer, so use the specificBrand constant.
static
constexpr
_
::
RawBrandedSchema
const
*
brand
=
&
TypeTag
::
specificBrand
;
static
constexpr
_
::
RawBrandedSchema
const
*
brand
()
{
return
&
TypeTag
::
specificBrand
;
}
};
template
<
typename
T
,
Kind
k
=
kind
<
T
>
()
>
...
...
@@ -146,14 +146,14 @@ struct BrandBindingFor_<T, Kind::ENUM> {
template
<
typename
T
>
struct
BrandBindingFor_
<
T
,
Kind
::
STRUCT
>
{
static
constexpr
RawBrandedSchema
::
Binding
get
(
uint16_t
listDepth
)
{
return
{
16
,
listDepth
,
T
::
_capnpPrivate
::
brand
};
return
{
16
,
listDepth
,
T
::
_capnpPrivate
::
brand
()
};
}
};
template
<
typename
T
>
struct
BrandBindingFor_
<
T
,
Kind
::
INTERFACE
>
{
static
constexpr
RawBrandedSchema
::
Binding
get
(
uint16_t
listDepth
)
{
return
{
17
,
listDepth
,
T
::
_capnpPrivate
::
brand
};
return
{
17
,
listDepth
,
T
::
_capnpPrivate
::
brand
()
};
}
};
...
...
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