MAK RTIspy API Documentation for HLA 1516
objParams13.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2010 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: .h,v $ $Revision: 1.2 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef ObjectParams13_H_
00010 #define ObjectParams13_H_
00011 
00012 #include "ballData.h"
00013 #include <sstream>
00014 
00015 // Converts a wstring to a string
00016 inline std::string toString(const std::wstring& inString)
00017 {
00018    std::string outString;
00019    std::wstring::const_iterator iter = inString.begin();
00020    const std::wstring::const_iterator endIter = inString.end();
00021    while (iter != endIter)
00022    {
00023       outString += static_cast<char>(*iter);
00024       ++iter;
00025    }
00026    return outString;
00027 }
00028 
00029 // Converts a string to a wstring
00030 inline std::wstring toWString(const std::string& inString)
00031 {
00032    std::wstring outString;
00033    std::string::const_iterator iter = inString.begin();
00034    const std::string::const_iterator endIter = inString.end();
00035    while (iter != endIter)
00036    {
00037       outString += *iter;
00038       ++iter;
00039    }
00040    return outString;
00041 }
00042 
00043 // Converts an unsigned integer to a wstring
00044 inline std::wstring toWString(unsigned int inNum)
00045 {
00046    std::wstringstream ssNum;
00047    ssNum << inNum;
00048    return ssNum.str();
00049 }
00050 
00051 class ObjectParams13 : public ObjectParams
00052 {
00053 public:
00054 
00055    ObjectParams13() : ObjectParams(), myInScope(true) {};
00056    virtual ~ObjectParams13() {};
00057 
00058    // Get a unique ID for this object based on the object handle
00059    virtual const std::wstring& id() const;
00060 
00061    // Get the object instance name
00062    virtual const std::wstring& name() const;
00063 
00064    // Accessors and mutators
00065    const RTI::ObjectClassHandle& classHandle() const;
00066    void setClassHandle(const RTI::ObjectClassHandle& handle);
00067 
00068    const RTI::ObjectHandle& instanceHandle() const;
00069    void setInstanceHandle(const RTI::ObjectHandle& handle);
00070 
00071    RTI::Region* region() const;
00072    void setRegion(RTI::Region* region);
00073 
00074    bool isInScope() const;
00075    void setIsInScope(bool inScope);
00076 
00077    void setInstanceName(const std::wstring& objName);
00078    void setInstanceName(const std::string& objName);
00079 
00080 protected:
00081 
00082    RTI::ObjectClassHandle myClassHandle;
00083    RTI::ObjectHandle myInstanceHandle;
00084    RTI::Region* myRegion;
00085    bool myInScope;
00086    std::wstring myInstanceHandleString;
00087    std::wstring myInstanceName;
00088 };
00089 
00090 inline const std::wstring& ObjectParams13::id() const
00091 {
00092    return myInstanceHandleString;
00093 }
00094 
00095 inline const std::wstring& ObjectParams13::name() const
00096 {
00097    return myInstanceName;
00098 }
00099 
00100 inline const RTI::ObjectClassHandle& ObjectParams13::classHandle() const
00101 {
00102    return myClassHandle;
00103 }
00104 
00105 inline void ObjectParams13::setClassHandle(const RTI::ObjectClassHandle& handle)
00106 {
00107    myClassHandle = handle;
00108 }
00109 
00110 inline const RTI::ObjectHandle& ObjectParams13::instanceHandle() const
00111 {
00112    return myInstanceHandle;
00113 }
00114 
00115 inline void ObjectParams13::setInstanceHandle(const RTI::ObjectHandle& handle)
00116 {
00117    myInstanceHandle = handle;
00118 
00119    std::wstringstream ssHandle;
00120    ssHandle << myInstanceHandle;
00121    myInstanceHandleString = ssHandle.str();
00122 }
00123 
00124 inline RTI::Region* ObjectParams13::region() const
00125 {
00126    return myRegion;
00127 }
00128 
00129 inline void ObjectParams13::setRegion(RTI::Region* region)
00130 {
00131    myRegion = region;
00132 }
00133 
00134 inline bool ObjectParams13::isInScope() const
00135 {
00136    return myInScope;
00137 }
00138 
00139 inline void ObjectParams13::setIsInScope(bool inScope)
00140 {
00141    myInScope = inScope;
00142 }
00143 
00144 inline void ObjectParams13::setInstanceName(const std::wstring& objName)
00145 {
00146    myInstanceName = objName;
00147 }
00148 
00149 inline void ObjectParams13::setInstanceName(const std::string& objName)
00150 {
00151    myInstanceName = toWString(objName);
00152 }
00153 
00154 #endif

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)