Bond
 
Loading...
Searching...
No Matches
runtime_schema.h
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#pragma once
5
6#include <bond/core/config.h>
7
8#include "detail/nonassignable.h"
9
10#include <bond/core/bond_types.h>
11
12#include <boost/shared_ptr.hpp>
13
14namespace bond
15{
16
17
18struct SchemaDef;
19struct TypeDef;
20struct StructDef;
21struct FieldDef;
22
26{
27public:
30 : schema(NULL),
31 type(NULL)
32 {}
33
34 RuntimeSchema(RuntimeSchema&& rhs) BOND_NOEXCEPT_IF(
35 std::is_nothrow_move_constructible<boost::shared_ptr<SchemaDef> >::value)
36 : schema(rhs.schema),
37 type(rhs.type),
38 instance(std::move(rhs.instance))
39 {}
40
41 RuntimeSchema& operator=(const RuntimeSchema& that) = default;
42
44 RuntimeSchema(const boost::shared_ptr<SchemaDef>& schema);
45
52 explicit RuntimeSchema(const SchemaDef& schema);
53
54 RuntimeSchema(const RuntimeSchema& schema);
55 RuntimeSchema(const RuntimeSchema& schema, const TypeDef& type);
56 RuntimeSchema(const RuntimeSchema& schema, const FieldDef& field);
57
58 const RuntimeSchema* get() const
59 {
60 return schema ? this : NULL;
61 }
62
64 const SchemaDef& GetSchema() const
65 {
66 return *schema;
67 }
68
69 const TypeDef& GetType() const
70 {
71 return *type;
72 }
73
74 bool HasBase() const;
75 RuntimeSchema GetBaseSchema() const;
76 const StructDef& GetStruct() const;
77 BondDataType GetTypeId() const;
78
79private:
80 const SchemaDef* schema;
81 const TypeDef* type;
82 boost::shared_ptr<SchemaDef> instance;
83};
84
85} // namespace bond
Represents runtime schema See User's Manual
Definition: runtime_schema.h:26
const SchemaDef & GetSchema() const
Returns constant reference to SchemaDef object.
Definition: runtime_schema.h:64
RuntimeSchema()
Default constructor.
Definition: runtime_schema.h:29
namespace bond
Definition: apply.h:17
STL namespace.