Commit 1963577d authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Add some beautifications - WIP

parent 2d361518
......@@ -14,7 +14,7 @@ namespace ITA
namespace simulation_scheduler
{
///
/// \brief Modells a source or reciever in 3D space.
/// \brief Models a source or receiver in 3D space.
///
class ITA_SIMULATION_SCHEDULER_API C3DObject : public IVistaSerializable
{
......@@ -32,7 +32,7 @@ namespace ITA
/// \brief Default constructor.
///
/// This constructor is primarily used for creating an object for deserialization.
/// It does not inizializes the object.
/// It does initializes the object with m_iID=-1 and m_eType=Type::source.
///
C3DObject ( ) = default;
......@@ -40,16 +40,16 @@ namespace ITA
/// \brief Constructor of a C3DObject.
///
/// C3DObject represent objects tracked in a virtual 3D environment.
/// These can be either a source or a reciever.
/// \param postion position of the C3DObject.
/// These can be either a source or a receiver.
/// \param position position of the C3DObject.
/// \param orientation orientation of the C3DObject.
/// \param type the Type of C3DObject.
/// \param id an identification number for the object.
///
C3DObject ( const VistaVector3D& postion, const VistaQuaternion& orientation, Type type, unsigned int id );
C3DObject ( const VistaVector3D& position, const VistaQuaternion& orientation, Type type, int id );
///
/// \brief Get the postion of the C3DObject.
/// \brief Get the position of the C3DObject.
/// \return a const ref to the position.
///
const VistaVector3D& getPosition ( ) const;
......@@ -88,31 +88,31 @@ namespace ITA
/// \param pSerializer the IVistaSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int Serialize ( IVistaSerializer& pSerializer ) const;
int Serialize ( IVistaSerializer& pSerializer ) const override;
///
/// \brief DeSerialize the object.
/// \param pSerializer the IVistaDeSerializer to use.
/// \param pDeserializer the IVistaDeSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int DeSerialize ( IVistaDeSerializer& pDeserializer );
int DeSerialize ( IVistaDeSerializer& pDeserializer ) override;
///
/// \brief Return a unique identifier for the object for serialization.
/// \return "CUpdateConfig".
///
virtual std::string GetSignature ( ) const;
virtual std::string GetSignature ( ) const override;
private:
///
/// \brief Identification number of the C3DObject.
///
unsigned int m_uiID;
int m_iID = -1;
///
/// \brief The type of the C3DObject.
///
Type m_eType;
Type m_eType = Type::source;
///
/// \brief The position of the C3DObject.
......@@ -124,7 +124,7 @@ namespace ITA
///
/// \brief The orientation of the C3DObject.
///
/// The orientation is encoded in Quadternion notation.
/// The orientation is encoded in Quaternion notation.
///
VistaQuaternion m_qOrientation;
};
......
......@@ -18,6 +18,7 @@ namespace ITA
///
class ITA_SIMULATION_SCHEDULER_API IConfig
{
virtual ~IConfig() = default;
///
/// \brief Load a configuration form a ini file.
/// \param sPath file path to the ini file to load from.
......
......@@ -34,7 +34,7 @@ namespace ITA
/// \brief Default constructor.
///
/// This constructor is primarily used for creating an object for deserialization.
/// It inizializes the object with ConfigChangeType::resetAll and an empty payload string.
/// It initializes the object with ConfigChangeType::resetAll and an empty payload string.
///
CUpdateConfig ( );
......@@ -44,40 +44,40 @@ namespace ITA
/// \param payload optional payload of the update.
/// Can encode a json file.
///
CUpdateConfig ( ConfigChangeType type, const std::string& payload = "" );
explicit CUpdateConfig ( ConfigChangeType type, std::string payload = "" );
///
/// \brief Get the ConfigChangeType of the update.
/// \return the ConfigChangeType of the update.
///
ConfigChangeType getType ( );
ConfigChangeType getType ( ) const;
///
/// \brief Get the payload of the update.
/// \return the payload of the update.
/// Can encode a json file.
///
const std::string& getPayload ( );
const std::string& getPayload ( ) const;
///
/// \brief Serialize the object.
/// \param pSerializer the IVistaSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int Serialize ( IVistaSerializer& pSerializer) const;
int Serialize ( IVistaSerializer& pSerializer) const override;
///
/// \brief DeSerialize the object.
/// \param pSerializer the IVistaDeSerializer to use.
/// \param pDeserializer the IVistaDeSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int DeSerialize ( IVistaDeSerializer& pDeserializer );
int DeSerialize ( IVistaDeSerializer& pDeserializer ) override;
///
/// \brief Return a unique identifier for the object for serialization.
/// \return "CUpdateConfig".
///
virtual std::string GetSignature ( ) const;
virtual std::string GetSignature ( ) const override;
private:
///
......
......@@ -13,7 +13,7 @@ namespace ITA
{
///
/// \brief Abstract base interface for all update messages that can be issued to a scheduler or master controller.
/// \remark Currently this base interface does nothing, maybe one day it gets an aditional use.
/// \remark Currently this base interface does nothing, maybe one day it gets an additional use.
///
class ITA_SIMULATION_SCHEDULER_API IUpdateMessage : public IVistaSerializable
{
......
......@@ -13,6 +13,9 @@
#include <ITA/simulation_scheduler/3d_object.h>
#include <ITA/simulation_scheduler/types.h>
// ITA includes
#include "ITAClock.h"
namespace ITA
{
namespace simulation_scheduler
......@@ -21,7 +24,7 @@ namespace ITA
/// \brief Special IUpdateMessage to signal scene changes.
///
/// A scene change is a change of a source or receiver pose.
/// A change of either source or receiver can lead to a change in the tansferpath between a coressponding source-receiver-pair.
/// A change of either source or receiver can lead to a change in the transfer path between a corresponding source-receiver-pair.
/// Thus, a CUpdateScene combines pose information for such a source-receiver-pair.
///
class ITA_SIMULATION_SCHEDULER_API CUpdateScene : public IUpdateMessage
......@@ -31,7 +34,7 @@ namespace ITA
/// \brief Default constructor.
///
/// This constructor is primarily used for creating an object for deserialization.
/// It initializes the object with nullptrs for source and receiver but no IDs.
/// It initializes the object with nullptrs for source and receiver and ID's to -1.
///
CUpdateScene ( ) = default;
......@@ -54,7 +57,7 @@ namespace ITA
///
/// With this function the CUpdateScene takes ownership of the objects.
/// \param pSource the new source for the update.
/// \param pReceiver the new reciever for the update.
/// \param pReceiver the new receiver for the update.
/// \todo Maybe split this function?
///
void setSourceReceiverPair ( std::unique_ptr<C3DObject> pSource, std::unique_ptr<C3DObject> pReceiver );
......@@ -89,20 +92,20 @@ namespace ITA
/// \param pSerializer the IVistaSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int Serialize ( IVistaSerializer& pSerializer ) const;
int Serialize ( IVistaSerializer& pSerializer ) const override;
///
/// \brief DeSerialize the object.
/// \param pSerializer the IVistaDeSerializer to use.
/// \param pDeserializer the IVistaDeSerializer to use.
/// \return the number of bytes written or -1 on failure.
///
int DeSerialize ( IVistaDeSerializer& pDeserializer );
int DeSerialize ( IVistaDeSerializer& pDeserializer ) override;
///
/// \brief Return a unique identifier for the object for serialization.
/// \return "CUpdateScene".
///
virtual std::string GetSignature ( ) const;
virtual std::string GetSignature ( ) const override;
private:
///
......@@ -118,14 +121,14 @@ namespace ITA
///
/// \brief The unique ID of the update.
///
unsigned int m_uiID;
int m_iID = -1;
///
/// \brief The reference ID of the update (For the user).
///
/// It encodes the source receiver path.
///
unsigned int m_uiReferenceID;
int m_iReferenceID = -1;
///
/// \brief Time stamp of the update.
......@@ -133,7 +136,7 @@ namespace ITA
/// Or for the profiler?
/// Define it.
///
double m_dTimeStamp;
double m_dTimeStamp = ITAClock::getDefaultClock ( )->getTime ( );
///
/// \brief updateSceneMaxID counts CUpdateScene%s that are constructed.
......
......@@ -12,14 +12,14 @@ namespace ITA
{
namespace simulation_scheduler
{
C3DObject::C3DObject ( const VistaVector3D& postion,
C3DObject::C3DObject ( const VistaVector3D& position,
const VistaQuaternion& orientation,
Type type,
unsigned int id ) :
m_v3Position ( postion ),
m_qOrientation ( orientation ),
const Type type,
const int id ) :
m_iID ( id ),
m_eType ( type ),
m_uiID ( id )
m_v3Position ( position ),
m_qOrientation ( orientation )
{ }
const VistaVector3D& C3DObject::getPosition ( ) const
{
......@@ -31,16 +31,16 @@ namespace ITA
}
unsigned int C3DObject::getID ( ) const
{
return m_uiID;
return m_iID;
}
C3DObject::Type C3DObject::getType ( ) const
{
return m_eType;
}
bool C3DObject::isEqualTolerance ( const C3DObject& obj, double dTolerance ) const
bool C3DObject::isEqualTolerance ( const C3DObject& obj, const double dTolerance ) const
{
if ( obj.m_eType == m_eType &&
obj.m_uiID == m_uiID )
obj.m_iID == m_iID )
{
return ( abs ( m_v3Position [0] - obj.m_v3Position [0] ) <= dTolerance &&
abs ( m_v3Position [1] - obj.m_v3Position [1] ) <= dTolerance &&
......@@ -66,7 +66,7 @@ namespace ITA
returnVal += pSerializer.WriteFloat32 ( m_qOrientation [2] );
returnVal += pSerializer.WriteFloat32 ( m_qOrientation [3] );
returnVal += pSerializer.WriteInt32 ( m_uiID );
returnVal += pSerializer.WriteInt32 ( m_iID );
returnVal += pSerializer.WriteInt32 ( static_cast< std::underlying_type<Type>::type >( m_eType ) );
......@@ -86,7 +86,7 @@ namespace ITA
returnVal += pDeserializer.ReadFloat32 ( m_qOrientation [2] );
returnVal += pDeserializer.ReadFloat32 ( m_qOrientation [3] );
returnVal += pDeserializer.ReadInt32 ( m_uiID );
returnVal += pDeserializer.ReadInt32 ( m_iID );
returnVal += pDeserializer.ReadInt32 ( tmp );
m_eType = Type ( tmp );
......
......@@ -5,6 +5,8 @@
#include <VistaAspects/VistaSerializer.h>
#include <VistaAspects/VistaDeSerializer.h>
#include <utility>
namespace ITA
{
namespace simulation_scheduler
......@@ -12,14 +14,14 @@ namespace ITA
CUpdateConfig::CUpdateConfig ( ) :
m_eConfigChangeType( ), m_sPayload( )
{ }
CUpdateConfig::CUpdateConfig ( ConfigChangeType type, const std::string& payload ) :
m_eConfigChangeType ( type ), m_sPayload ( payload )
CUpdateConfig::CUpdateConfig (const ConfigChangeType type, std::string payload ) :
m_eConfigChangeType ( type ), m_sPayload (std::move(payload))
{ }
CUpdateConfig::ConfigChangeType CUpdateConfig::getType ( )
CUpdateConfig::ConfigChangeType CUpdateConfig::getType ( ) const
{
return m_eConfigChangeType;
}
const std::string& CUpdateConfig::getPayload ( )
const std::string& CUpdateConfig::getPayload ( ) const
{
return m_sPayload;
}
......
......@@ -14,9 +14,9 @@ namespace ITA
{
unsigned int CUpdateScene::updateSceneMaxID = 0;
CUpdateScene::CUpdateScene ( unsigned int referenceID ) :
m_uiReferenceID ( referenceID )
m_iReferenceID ( referenceID )
{
m_uiID = updateSceneMaxID++;
m_iID = updateSceneMaxID++;
}
SourceReceiverPair CUpdateScene::getSourceReceiverPair ( ) const
{
......@@ -41,26 +41,26 @@ namespace ITA
}
unsigned int CUpdateScene::getID ( ) const
{
return m_uiID;
return m_iID;
}
unsigned int CUpdateScene::getReferenceID ( ) const
{
return m_uiReferenceID;
return m_iReferenceID;
}
bool CUpdateScene::isEqualTolerance ( const CUpdateScene& obj, double dTolerance ) const
{
return m_pSource->isEqualTolerance(*obj.m_pSource.get(), dTolerance) &&
m_pReceiver->isEqualTolerance ( *obj.m_pReceiver.get ( ), dTolerance ) &&
m_uiReferenceID == obj.m_uiReferenceID;
return m_pSource->isEqualTolerance(*obj.m_pSource, dTolerance) &&
m_pReceiver->isEqualTolerance ( *obj.m_pReceiver, dTolerance ) &&
m_iReferenceID == obj.m_iReferenceID;
}
int CUpdateScene::Serialize ( IVistaSerializer& pSerializer ) const
{
int returnVal = 0;
returnVal += pSerializer.WriteInt32 ( m_uiID );
returnVal += pSerializer.WriteInt32 ( m_uiReferenceID );
returnVal += pSerializer.WriteSerializable ( *m_pReceiver.get ( ) );
returnVal += pSerializer.WriteSerializable ( *m_pSource.get ( ) );
returnVal += pSerializer.WriteInt32 ( m_iID );
returnVal += pSerializer.WriteInt32 ( m_iReferenceID );
returnVal += pSerializer.WriteSerializable ( *m_pReceiver);
returnVal += pSerializer.WriteSerializable ( *m_pSource);
return returnVal;
}
......@@ -68,8 +68,8 @@ namespace ITA
{
int returnVal = 0;
returnVal += pDeserializer.ReadInt32 ( m_uiID );
returnVal += pDeserializer.ReadInt32 ( m_uiReferenceID );
returnVal += pDeserializer.ReadInt32 ( m_iID );
returnVal += pDeserializer.ReadInt32 ( m_iReferenceID );
if ( m_pReceiver == nullptr && m_pSource == nullptr )
{
C3DObject tmp;
......@@ -81,8 +81,8 @@ namespace ITA
}
else
{
returnVal += pDeserializer.ReadSerializable ( *m_pReceiver.get ( ) );
returnVal += pDeserializer.ReadSerializable ( *m_pSource.get ( ) );
returnVal += pDeserializer.ReadSerializable ( *m_pReceiver);
returnVal += pDeserializer.ReadSerializable ( *m_pSource);
}
return returnVal;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment