void
HLAObjectInstance::updateAttributeValues(const RTIData& tag)
{
- if (_attributeCallback.valid())
- _attributeCallback->updateAttributeValues(*this, tag);
if (_updateCallback.valid()) {
_updateCallback->updateAttributeValues(*this, tag);
} else {
void
HLAObjectInstance::updateAttributeValues(const SGTimeStamp& timeStamp, const RTIData& tag)
{
- if (_attributeCallback.valid())
- _attributeCallback->updateAttributeValues(*this, tag);
if (_updateCallback.valid()) {
_updateCallback->updateAttributeValues(*this, timeStamp, tag);
} else {
{
if (_reflectCallback.valid()) {
_reflectCallback->reflectAttributeValues(*this, indexList, tag);
- } else if (_attributeCallback.valid()) {
- reflectAttributeValues(indexList, tag);
-
- RTIIndexDataPairList dataPairList;
- for (HLAIndexList::const_iterator i = indexList.begin(); i != indexList.end(); ++i) {
- dataPairList.push_back(RTIIndexDataPair());
- dataPairList.back().first = *i;
- getAttributeData(*i, dataPairList.back().second);
- }
- _attributeCallback->reflectAttributeValues(*this, dataPairList, tag);
} else {
reflectAttributeValues(indexList, tag);
}
{
if (_reflectCallback.valid()) {
_reflectCallback->reflectAttributeValues(*this, indexList, timeStamp, tag);
- } else if (_attributeCallback.valid()) {
- reflectAttributeValues(indexList, timeStamp, tag);
-
- RTIIndexDataPairList dataPairList;
- for (HLAIndexList::const_iterator i = indexList.begin(); i != indexList.end(); ++i) {
- dataPairList.push_back(RTIIndexDataPair());
- dataPairList.back().first = *i;
- getAttributeData(*i, dataPairList.back().second);
- }
- _attributeCallback->reflectAttributeValues(*this, dataPairList, timeStamp, tag);
} else {
reflectAttributeValues(indexList, timeStamp, tag);
}
const SGSharedPtr<ReflectCallback>& getReflectCallback() const
{ return _reflectCallback; }
- // deprecated.
- class AttributeCallback : public SGReferenced {
- public:
- virtual ~AttributeCallback() {}
- virtual void updateAttributeValues(HLAObjectInstance& objectInstance, const RTIData& tag)
- { }
- virtual void reflectAttributeValues(HLAObjectInstance& objectInstance,
- const RTIIndexDataPairList& dataPairList, const RTIData& tag)
- { }
- virtual void reflectAttributeValues(HLAObjectInstance& objectInstance, const RTIIndexDataPairList& dataPairList,
- const SGTimeStamp& timeStamp, const RTIData& tag)
- { reflectAttributeValues(objectInstance, dataPairList, tag); }
- };
-
- void setAttributeCallback(const SGSharedPtr<AttributeCallback>& attributeCallback)
- { _attributeCallback = attributeCallback; }
- const SGSharedPtr<AttributeCallback>& getAttributeCallback() const
- { return _attributeCallback; }
-
private:
void _setRTIObjectInstance(RTIObjectInstance* rtiObjectInstance);
void _clearRTIObjectInstance();
// Callback classes
SGSharedPtr<UpdateCallback> _updateCallback;
SGSharedPtr<ReflectCallback> _reflectCallback;
- SGSharedPtr<AttributeCallback> _attributeCallback;
friend class HLAFederate;
friend class HLAObjectClass;