]> git.mxchange.org Git - simgear.git/commitdiff
hla: Remove deprecated ObjectModelFactory interface.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 29 Jul 2012 18:43:39 +0000 (20:43 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 29 Jul 2012 18:44:58 +0000 (20:44 +0200)
simgear/hla/HLAFederate.cxx
simgear/hla/HLAFederate.hxx

index 55798d244401eaa2586f52d954e465dc9da730ec..75465af470ddf0d0fc96da1231c67c0e47db60f6 100644 (file)
@@ -754,77 +754,6 @@ HLAFederate::processMessages()
     return true;
 }
 
-bool
-HLAFederate::readObjectModelTemplate(const std::string& objectModel,
-                                     HLAFederate::ObjectModelFactory& objectModelFactory)
-{
-    // The XML version of the federate object model.
-    // This one covers the generic attributes, parameters and data types.
-    HLAOMTXmlVisitor omtXmlVisitor;
-    try {
-        readXML(objectModel, omtXmlVisitor);
-    } catch (const sg_throwable& e) {
-        SG_LOG(SG_IO, SG_ALERT, "Could not open HLA XML object model file: "
-               << e.getMessage());
-        return false;
-    } catch (...) {
-        SG_LOG(SG_IO, SG_ALERT, "Could not open HLA XML object model file");
-        return false;
-    }
-
-    omtXmlVisitor.setDataTypesToFederate(*this);
-
-    unsigned numObjectClasses = omtXmlVisitor.getNumObjectClasses();
-    for (unsigned i = 0; i < numObjectClasses; ++i) {
-        const HLAOMTXmlVisitor::ObjectClass* objectClass = omtXmlVisitor.getObjectClass(i);
-        std::string objectClassName = objectClass->getName();
-
-        SGSharedPtr<HLAObjectClass> hlaObjectClass = objectModelFactory.createObjectClass(objectClassName, *this);
-        if (!hlaObjectClass.valid()) {
-            SG_LOG(SG_IO, SG_INFO, "Ignoring object class \"" << objectClassName << "\".");
-            continue;
-        }
-
-        bool publish = objectModelFactory.publishObjectClass(objectClassName, objectClass->getSharing());
-        bool subscribe = objectModelFactory.subscribeObjectClass(objectClassName, objectClass->getSharing());
-
-        // process the attributes
-        for (unsigned j = 0; j < objectClass->getNumAttributes(); ++j) {
-            const simgear::HLAOMTXmlVisitor::Attribute* attribute;
-            attribute = objectClass->getAttribute(j);
-
-            std::string attributeName = attribute->getName();
-            unsigned index = hlaObjectClass->addAttribute(attributeName);
-
-            if (index == ~0u) {
-                SG_LOG(SG_IO, SG_WARN, "RTI does not know the \"" << attributeName << "\" attribute!");
-                continue;
-            }
-
-            // the attributes datatype
-            SGSharedPtr<const HLADataType> dataType = getDataType(attribute->getDataType());
-            if (!dataType.valid()) {
-                SG_LOG(SG_IO, SG_WARN, "Could not find data type for attribute \""
-                       << attributeName << "\" in object class \"" << objectClassName << "\"!");
-            }
-            hlaObjectClass->setAttributeDataType(index, dataType);
-            hlaObjectClass->setAttributeUpdateType(index, attribute->getUpdateType());
-            if (subscribe && objectModelFactory.subscribeAttribute(objectClassName, attributeName, attribute->_sharing))
-                hlaObjectClass->setAttributeSubscriptionType(index, attribute->getSubscriptionType());
-            if (publish && objectModelFactory.publishAttribute(objectClassName, attributeName, attribute->_sharing))
-                hlaObjectClass->setAttributePublicationType(index, attribute->getPublicationType());
-        }
-
-        if (publish)
-            hlaObjectClass->publish();
-        if (subscribe)
-            hlaObjectClass->subscribe();
-
-    }
-
-    return resolveObjectModel();
-}
-
 bool
 HLAFederate::readRTI13ObjectModelTemplate(const std::string& objectModel)
 {
index 1f071f14c389892c9c36d45eb0185e763ebb076d..4b1d4164869c40d1dec86f1b6fccf2015430d8d5 100644 (file)
@@ -162,28 +162,6 @@ public:
     /// a pending time advance is granted.
     bool processMessages();
 
-    class ObjectModelFactory {
-    public:
-        virtual ~ObjectModelFactory()
-        { }
-
-        virtual HLAObjectClass* createObjectClass(const std::string& name, HLAFederate& federate)
-        { return federate.createObjectClass(name); }
-        virtual bool subscribeObjectClass(const std::string& objectClassName, const std::string& sharing)
-        { return sharing.find("Subscribe") != std::string::npos; }
-        virtual bool publishObjectClass(const std::string& objectClassName, const std::string& sharing)
-        { return sharing.find("Publish") != std::string::npos; }
-        virtual bool subscribeAttribute(const std::string& objectClassName, const std::string& attributeName, const std::string& sharing)
-        { return sharing.find("Subscribe") != std::string::npos; }
-        virtual bool publishAttribute(const std::string& objectClassName, const std::string& attributeName, const std::string& sharing)
-        { return sharing.find("Publish") != std::string::npos; }
-
-    };
-
-    /// Read an omt xml file - deprecated
-    bool readObjectModelTemplate(const std::string& objectModel,
-                                 ObjectModelFactory& objectModelFactory);
-
     /// Read an rti1.3 omt xml file
     bool readRTI13ObjectModelTemplate(const std::string& objectModel);
     /// Read an rti1516 omt xml file