9 #ifndef CMHPropertiesValuesList_H
10 #define CMHPropertiesValuesList_H
75 CSerializablePtr get(
const char *propertyName,
const int64_t & hypothesis_ID )
const;
80 typename T::SmartPtr
getAs(
const char *propertyName,
const int64_t & hypothesis_ID,
bool allowNullPointer =
true)
const
83 CSerializablePtr obj = get(propertyName,hypothesis_ID);
87 return typename T::SmartPtr();
91 ASSERT_( class_ID == obj->GetRuntimeClass() );
92 return typename T::SmartPtr( obj );
99 CSerializablePtr getAnyHypothesis(
const char *propertyName)
const;
104 void set(
const char *propertyName,
const CSerializablePtr &obj,
const int64_t & hypothesis_ID);
109 void setMemoryReference(
const char *propertyName,
const CSerializablePtr& obj,
const int64_t & hypothesis_ID);
113 void remove(
const char *propertyName,
const int64_t & hypothesis_ID);
117 void removeAll(
const int64_t & hypothesis_ID);
122 void setElemental(
const char *propertyName,
const T &data,
const int64_t & hypothesis_ID)
126 CMemoryChunkPtr memChunk = CMemoryChunkPtr(
new CMemoryChunk() );
127 memChunk->setAllocBlockSize(10);
136 it->value = memChunk;
143 newPair.
name = std::string(propertyName);
144 newPair.
value = memChunk;
145 newPair.
ID = hypothesis_ID;
146 m_properties.push_back(newPair);
149 printf(
"Exception while setting annotation '%s'",propertyName); \
157 bool getElemental(
const char *propertyName, T &out_data,
const int64_t & hypothesis_ID,
bool raiseExceptionIfNotFound =
false)
const
164 CMemoryChunkPtr memChunk = CMemoryChunkPtr(it->value);
166 if (memChunk->getTotalBytesCount()!=
sizeof(out_data))
THROW_EXCEPTION(
"Data sizes do not match.");
167 out_data = *
static_cast<T*
>( memChunk->getRawBufferData() );
172 if (raiseExceptionIfNotFound)
180 std::vector<std::string> getPropertyNames()
const;
191 size_t size()
const {
return m_properties.size(); }