# RTItypesImp.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002-2005  ONERA
    00004 //
    00005 // This file is part of CERTI-libRTI
    00006 //
    00007 // CERTI-libRTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libRTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: RTItypesImp.hh,v 3.3 2009/04/04 13:18:13 gotthardp Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef _RTI_TYPESIMP_HH
    00026 #define _RTI_TYPESIMP_HH
    00027
    00028 #include "certi.hh"
    00029 #include "Extent.hh"
    00030
    00031 namespace certi {
    00032
    00033 template<class I>
    00034 struct certi_cast
    00035 {
    00036     template<class R>
    00037     const I& operator()(const R& imp)
    00038     {
    00039         try {
    00040             return dynamic_cast<const I&>(imp);
    00041         }
    00042         catch (...)
    00043         {
    00044             throw RTI::RTIinternalError("Incompatible object on input.");
    00045         }
    00046     }
    00047
    00048     template<class R>
    00049     I& operator()(R& imp)
    00050     {
    00051         try {
    00052             return dynamic_cast<I&>(imp);
    00053         }
    00054         catch (...)
    00055         {
    00056             throw RTI::RTIinternalError("Incompatible object on input.");
    00057         }
    00058     }
    00059 };
    00060
    00061 typedef std::pair<AttributeHandle, AttributeValue_t> AttributeHandleValuePair_t;
    00062
    00063 class RTI_EXPORT AttributeHandleValuePairSetImp : public RTI::AttributeHandleValuePairSet
    00064 {
    00065 public:
    00066     AttributeHandleValuePairSetImp(ULong);
    00067     AttributeHandleValuePairSetImp(const std::vector<AttributeHandleValuePair_t> &);
    00068
    00069     virtual ~AttributeHandleValuePairSetImp();
    00070
    00071     virtual ULong size() const;
    00072
    00073     virtual Handle getHandle(ULong) const
    00074         throw (RTI::ArrayIndexOutOfBounds);
    00075
    00076     virtual ULong getValueLength(ULong) const
    00077         throw (RTI::ArrayIndexOutOfBounds);
    00078
    00079     virtual void getValue(ULong, char *, ULong &) const
    00080         throw (RTI::ArrayIndexOutOfBounds);
    00081
    00082     virtual char *getValuePointer(ULong, ULong &) const
    00083         throw (RTI::ArrayIndexOutOfBounds);
    00084
    00085     virtual TransportType getTransportType(ULong) const
    00086         throw (RTI::InvalidHandleValuePairSetContext);
    00087
    00088     virtual OrderType getOrderType(ULong) const
    00089         throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext);
    00090
    00091     virtual RTI::Region *getRegion(ULong) const
    00092         throw (RTI::ArrayIndexOutOfBounds, RTI::InvalidHandleValuePairSetContext);
    00093
    00094     virtual void add(Handle, const char *, ULong)
    00095         throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
    00096
    00097     virtual void remove(Handle h)
    00098         throw (RTI::ArrayIndexOutOfBounds);
    00099
    00100     virtual void moveFrom(const AttributeHandleValuePairSet &, ULong &)
    00101         throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
    00102
    00103     virtual void empty();
    00104
    00105     virtual ULong start() const;
    00106     virtual ULong valid(ULong i) const;
    00107     virtual ULong next(ULong i) const;
    00108
    00109     const std::vector<AttributeHandleValuePair_t>& getAttributeHandleValuePairs() const;
    00110
    00111 protected:
    00112     std::vector<AttributeHandleValuePair_t> _set;
    00113     OrderType _order ;
    00114     TransportType _transport ;
    00115 };
    00116
    00117 class RTI_EXPORT AttributeHandleSetImp : public RTI::AttributeHandleSet
    00118 {
    00119 public:
    00120     AttributeHandleSetImp(ULong);
    00121     AttributeHandleSetImp(const std::vector<AttributeHandle> &);
    00122
    00123     virtual ~AttributeHandleSetImp();
    00124
    00125     virtual ULong size() const;
    00126
    00127     virtual AttributeHandle getHandle(ULong) const
    00128         throw (RTI::ArrayIndexOutOfBounds);
    00129
    00130     virtual void add(AttributeHandle)
    00131         throw (RTI::ArrayIndexOutOfBounds, RTI::AttributeNotDefined);
    00132
    00133     virtual void remove(AttributeHandle)
    00134         throw (RTI::AttributeNotDefined);
    00135
    00136     virtual void empty();
    00137
    00138     virtual RTI::Boolean isEmpty() const;
    00139     virtual RTI::Boolean isMember(AttributeHandle h) const;
    00140
    00141     const std::vector<AttributeHandle>& getAttributeHandles() const;
    00142
    00143 protected:
    00144     std::vector<AttributeHandle> _set;
    00145 };
    00146
    00147 class RTI_EXPORT FederateHandleSetImp : public RTI::FederateHandleSet
    00148 {
    00149 public:
    00150     FederateHandleSetImp(ULong);
    00151     virtual ~FederateHandleSetImp();
    00152
    00153     virtual ULong size() const;
    00154
    00155     virtual FederateHandle getHandle(ULong) const
    00156         throw (RTI::ArrayIndexOutOfBounds);
    00157
    00158     virtual void add(FederateHandle)
    00159         throw (RTI::ValueCountExceeded);
    00160
    00161     virtual void remove(FederateHandle)
    00162         throw (RTI::ArrayIndexOutOfBounds);
    00163
    00164     virtual void empty();
    00165
    00166     virtual RTI::Boolean isMember(FederateHandle) const;
    00167
    00168 protected:
    00169     std::vector<FederateHandle> _set;
    00170 };
    00171
    00172 typedef std::pair<ParameterHandle, ParameterValue_t> ParameterHandleValuePair_t;
    00173
    00174 class RTI_EXPORT ParameterHandleValuePairSetImp : public RTI::ParameterHandleValuePairSet
    00175 {
    00176 public:
    00177     ParameterHandleValuePairSetImp(ULong);
    00178     ParameterHandleValuePairSetImp(const std::vector<ParameterHandleValuePair_t> &);
    00179     virtual ~ParameterHandleValuePairSetImp();
    00180
    00181     virtual ULong size() const;
    00182
    00183     virtual Handle getHandle(ULong) const
    00184         throw (RTI::ArrayIndexOutOfBounds);
    00185
    00186     virtual ULong getValueLength(ULong) const
    00187         throw (RTI::ArrayIndexOutOfBounds);
    00188
    00189     virtual void getValue(ULong, char *, ULong &) const
    00190         throw (RTI::ArrayIndexOutOfBounds);
    00191
    00192     virtual char *getValuePointer(ULong, ULong &) const
    00193         throw (RTI::ArrayIndexOutOfBounds);
    00194
    00195     virtual TransportType getTransportType() const
    00196         throw (RTI::InvalidHandleValuePairSetContext);
    00197
    00198     virtual OrderType getOrderType() const
    00199         throw (RTI::InvalidHandleValuePairSetContext);
    00200
    00201     virtual RTI::Region *getRegion() const
    00202         throw (RTI::InvalidHandleValuePairSetContext);
    00203
    00204     virtual void add(Handle, const char *, ULong)
    00205         throw (RTI::ValueLengthExceeded, RTI::ValueCountExceeded);
    00206
    00207     virtual void remove(Handle)
    00208         throw (RTI::ArrayIndexOutOfBounds);
    00209
    00210     virtual void moveFrom(const ParameterHandleValuePairSet &, ULong &)
    00211         throw (RTI::ValueCountExceeded, RTI::ArrayIndexOutOfBounds);
    00212
    00213     virtual void empty();
    00214
    00215     virtual ULong start() const;
    00216     virtual ULong valid(ULong i) const;
    00217     virtual ULong next(ULong i) const;
    00218
    00219     const std::vector<ParameterHandleValuePair_t>& getParameterHandleValuePairs() const;
    00220
    00221 protected:
    00222     std::vector<ParameterHandleValuePair_t> _set;
    00223     OrderType _order ;
    00224     TransportType _transport ;
    00225 };
    00226
    00227
    00228 class RTI_EXPORT RegionImp : public RTI::Region
    00229 {
    00230 public:
    00231     RegionImp(RegionHandle, SpaceHandle, const std::vector<Extent> &);
    00232     virtual ~RegionImp();
    00233
    00234     virtual ULong getRangeLowerBound(ExtentIndex, DimensionHandle) const
    00235         throw (RTI::ArrayIndexOutOfBounds);
    00236
    00237     virtual ULong getRangeUpperBound(ExtentIndex, DimensionHandle) const
    00238         throw (RTI::ArrayIndexOutOfBounds);
    00239
    00240     virtual void setRangeLowerBound(ExtentIndex, DimensionHandle, ULong)
    00241         throw (RTI::ArrayIndexOutOfBounds);
    00242
    00243     virtual void setRangeUpperBound(ExtentIndex, DimensionHandle, ULong)
    00244         throw (RTI::ArrayIndexOutOfBounds);
    00245
    00246     virtual SpaceHandle getSpaceHandle() const
    00247         throw ();
    00248
    00249     virtual ULong getNumberOfExtents() const
    00250         throw ();
    00251
    00252     virtual ULong getRangeLowerBoundNotificationLimit(ExtentIndex, DimensionHandle) const
    00253         throw (RTI::ArrayIndexOutOfBounds);
    00254
    00255     virtual ULong getRangeUpperBoundNotificationLimit(ExtentIndex, DimensionHandle) const
    00256         throw (RTI::ArrayIndexOutOfBounds);
    00257
    00258 private:
    00259     RegionHandle handle;
    00260     SpaceHandle space;
    00261     std::vector<Extent> extents;
    00262
    00263     std::vector<Extent> coExtents;
    00264 };
    00265
    00266 }
    00267
    00268 #endif // _RTI_TYPESIMP_HH
    00269
    00270 // $Id: RTItypesImp.hh,v 3.3 2009/04/04 13:18:13 gotthardp Exp $