From 50380bc6c525bf06158341e3181f1f6ff0542b88 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sun, 4 Mar 2012 21:34:09 +0100 Subject: [PATCH] hla: Provide access to the parent federate. --- simgear/hla/HLAInteractionClass.cxx | 6 ++++++ simgear/hla/HLAInteractionClass.hxx | 3 +++ simgear/hla/HLAObjectClass.cxx | 6 ++++++ simgear/hla/HLAObjectClass.hxx | 3 +++ simgear/hla/HLAObjectInstance.cxx | 18 ++++++++++++++++++ simgear/hla/HLAObjectInstance.hxx | 15 +++++++++------ 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/simgear/hla/HLAInteractionClass.cxx b/simgear/hla/HLAInteractionClass.cxx index b56aec44..e2674d3f 100644 --- a/simgear/hla/HLAInteractionClass.cxx +++ b/simgear/hla/HLAInteractionClass.cxx @@ -55,6 +55,12 @@ HLAInteractionClass::getName() const return _name; } +const SGWeakPtr& +HLAInteractionClass::getFederate() const +{ + return _federate; +} + HLASubscriptionType HLAInteractionClass::getSubscriptionType() const { diff --git a/simgear/hla/HLAInteractionClass.hxx b/simgear/hla/HLAInteractionClass.hxx index 4e1d1531..34a25c7e 100644 --- a/simgear/hla/HLAInteractionClass.hxx +++ b/simgear/hla/HLAInteractionClass.hxx @@ -41,6 +41,9 @@ public: const std::string& getName() const; + /// return the federate this interaction class belongs to + const SGWeakPtr& getFederate() const; + HLASubscriptionType getSubscriptionType() const; void setSubscriptionType(HLASubscriptionType subscriptionType); diff --git a/simgear/hla/HLAObjectClass.cxx b/simgear/hla/HLAObjectClass.cxx index 9d4146d2..5bd86c0c 100644 --- a/simgear/hla/HLAObjectClass.cxx +++ b/simgear/hla/HLAObjectClass.cxx @@ -81,6 +81,12 @@ HLAObjectClass::getName() const return _name; } +const SGWeakPtr& +HLAObjectClass::getFederate() const +{ + return _federate; +} + unsigned HLAObjectClass::getNumAttributes() const { diff --git a/simgear/hla/HLAObjectClass.hxx b/simgear/hla/HLAObjectClass.hxx index ea054a48..6a04f4a1 100644 --- a/simgear/hla/HLAObjectClass.hxx +++ b/simgear/hla/HLAObjectClass.hxx @@ -38,6 +38,9 @@ public: /// Return the name of this object class const std::string& getName() const; + /// return the federate this class belongs to + const SGWeakPtr& getFederate() const; + /// Return the number of attributes in this object class unsigned getNumAttributes() const; diff --git a/simgear/hla/HLAObjectInstance.cxx b/simgear/hla/HLAObjectInstance.cxx index a163c595..56ccf78e 100644 --- a/simgear/hla/HLAObjectInstance.cxx +++ b/simgear/hla/HLAObjectInstance.cxx @@ -51,6 +51,24 @@ HLAObjectInstance::~HLAObjectInstance() _clearRTIObjectInstance(); } +const std::string& +HLAObjectInstance::getName() const +{ + return _name; +} + +const SGWeakPtr& +HLAObjectInstance::getFederate() const +{ + return _federate; +} + +const SGSharedPtr& +HLAObjectInstance::getObjectClass() const +{ + return _objectClass; +} + unsigned HLAObjectInstance::getNumAttributes() const { diff --git a/simgear/hla/HLAObjectInstance.hxx b/simgear/hla/HLAObjectInstance.hxx index 1262d6de..d0f47b08 100644 --- a/simgear/hla/HLAObjectInstance.hxx +++ b/simgear/hla/HLAObjectInstance.hxx @@ -39,13 +39,14 @@ public: virtual ~HLAObjectInstance(); /// Return the name of this object instance - const std::string& getName() const - { return _name; } + const std::string& getName() const; + + /// return the federate this instance belongs to + const SGWeakPtr& getFederate() const; /// Return the object class of this instance. /// Should always return a valid object class. - const SGSharedPtr& getObjectClass() const - { return _objectClass; } + const SGSharedPtr& getObjectClass() const; /// Return the number of attributes unsigned getNumAttributes() const; @@ -55,7 +56,8 @@ public: /// Return the attribute name for the attribute with the given index std::string getAttributeName(unsigned index) const; - /// Return true if the attribute with the given index is owned by this federate + /// Return true if the attribute with the given index is owned by + /// this federate bool getAttributeOwned(unsigned index) const; /// Return the data type of the attribute with the given index @@ -65,7 +67,8 @@ public: HLADataElement* getAttributeDataElement(unsigned index); const HLADataElement* getAttributeDataElement(unsigned index) const; - /// Write the raw attribute data value into data, works only of the object is backed up with an rti object instance + /// Write the raw attribute data value into data, works only of the object + /// is backed up with an rti object instance bool getAttributeData(unsigned index, RTIData& data) const; /// Sets the data element of the attribute with the given index to dataElement -- 2.39.5