7 #define epicsExportSharedSymbols 18 const int8 IntrospectionRegistry::NULL_TYPE_CODE = (
int8)-1;
19 const int8 IntrospectionRegistry::ONLY_ID_TYPE_CODE = (
int8)-2;
20 const int8 IntrospectionRegistry::FULL_WITH_ID_TYPE_CODE = (
int8)-3;
23 IntrospectionRegistry::IntrospectionRegistry()
28 IntrospectionRegistry::~IntrospectionRegistry()
33 void IntrospectionRegistry::reset()
39 int16 IntrospectionRegistry::registerIntrospectionInterface(
FieldConstPtr const & field,
bool& existing)
43 if(registryContainsValue(field, key))
51 _registry[key] = field;
57 bool IntrospectionRegistry::registryContainsValue(
FieldConstPtr const & field,
int16& key)
59 for(registryMap_t::reverse_iterator registryRIter = _registry.rbegin(); registryRIter != _registry.rend(); registryRIter++)
61 if(*(field.get()) == *(registryRIter->second))
63 key = registryRIter->first;
72 if (field.get() ==
NULL)
74 SerializationHelper::serializeNullField(buffer, control);
81 if (field->getType() !=
scalar &&
85 const int16 key = registerIntrospectionInterface(field, existing);
88 buffer->
putByte(ONLY_ID_TYPE_CODE);
94 buffer->
putByte(FULL_WITH_ID_TYPE_CODE);
99 field->serialize(buffer, control);
109 if (typeCode == NULL_TYPE_CODE)
113 else if (typeCode == ONLY_ID_TYPE_CODE)
118 registryMap_t::iterator registryIter = _registry.find(
id);
119 if(registryIter == _registry.end())
123 throw std::runtime_error(
"IntrospectionRegistry miss.");
125 return registryIter->second;
128 if(typeCode == IntrospectionRegistry::FULL_WITH_ID_TYPE_CODE)
131 const short key = buffer->
getShort();
132 FieldConstPtr field = _fieldCreate->deserialize(buffer, control);
133 _registry[key] = field;
139 return _fieldCreate->deserialize(buffer, control);
EPICS_ALWAYS_INLINE int8 getByte()
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
TODO only here because of the Lockable.
Callback class for deserialization.
std::size_t getPosition() const
void setPosition(std::size_t pos)
EPICS_ALWAYS_INLINE void putByte(int8 value)
This class implements a Bytebuffer that is like the java.nio.ByteBuffer.
EPICS_ALWAYS_INLINE int16 getShort()
std::tr1::shared_ptr< const Field > FieldConstPtr
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
std::tr1::shared_ptr< FieldCreate > FieldCreatePtr
virtual void ensureBuffer(std::size_t size)=0
Callback class for serialization.
virtual void ensureData(std::size_t size)=0
EPICS_ALWAYS_INLINE void putShort(int16 value)