Commit e2dc58ff authored by bucyril's avatar bucyril
Browse files

added DataStreamClient.h

parent 0dcc828e
......@@ -118,6 +118,7 @@ catkin_package(
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
include
)
## Declare a C++ library
......
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) OMG Plc 2009.
// All rights reserved. This software is protected by copyright
// law and international treaties. No part of this software / document
// may be reproduced or distributed in any form or by any means,
// whether transiently or incidentally to some other use of this software,
// without the written permission of the copyright owner.
//
///////////////////////////////////////////////////////////////////////////////
#pragma once
/// \file
/// The SDK client and supporting definitions.
#ifdef WIN32
#ifdef _EXPORTING
#define CLASS_DECLSPEC __declspec(dllexport)
#else
#define CLASS_DECLSPEC __declspec(dllimport)
#endif // _EXPORTING
#elif defined( __GNUC__ )
#if __GNUC__ < 4
#error gcc 4 is required.
#endif
#define CLASS_DECLSPEC __attribute__((visibility("default")))
#else
#define CLASS_DECLSPEC
#endif
#include <string>
#include <vector>
namespace ViconDataStreamSDK
{
namespace CPP
{
class IStringFactory
{
public:
virtual char * AllocAndCopyString( const char * i_pSource ) = 0;
virtual void FreeString( char * i_pString ) = 0;
protected:
virtual ~IStringFactory() {}
};
// A string managing class for DLL boundry safe text.
// It ensures that strings are de-allocated with the same
// memory manager they are made with. This allows you to use a debug
// build of your client with a release SDK.
class String
{
public:
// A string which we are not responsible for deallocating
inline
String( const char * i_pString = 0 )
: m_pString( 0 )
, m_pConstString( i_pString )
, m_pStringFactory( 0 )
{
}
// A string which we are not responsible for deallocating
String( const std::string & i_rString )
: m_pString( 0 )
, m_pConstString( i_rString.c_str() )
, m_pStringFactory( 0 )
{
}
// Copy constructor
inline
String( const String & i_rString )
{
m_pConstString = i_rString.m_pConstString;
m_pStringFactory = i_rString.m_pStringFactory;
if( m_pStringFactory )
{
m_pString = m_pStringFactory->AllocAndCopyString( i_rString.m_pString );
}
else
{
m_pString = 0;
}
}
inline
~String()
{
if( m_pStringFactory )
{
m_pStringFactory->FreeString( m_pString );
}
}
// A string which we are responsible for deallocating
inline
void Set( const char * i_pString, IStringFactory & i_rStringFactory )
{
m_pString = i_rStringFactory.AllocAndCopyString( i_pString );
m_pStringFactory = &i_rStringFactory;
m_pConstString = 0;
}
inline
operator std::string() const
{
if( m_pStringFactory )
{
return std::string( m_pString );
}
else
{
return std::string( m_pConstString );
}
}
private:
char * m_pString;
const char * m_pConstString;
IStringFactory * m_pStringFactory;
};
// Streaming operator for String
inline std::ostream & operator<<( std::ostream & io_rStream, const String & i_rString )
{
io_rStream << std::string( i_rString );
return io_rStream;
}
namespace Direction
{
enum Enum
{
Up,
Down,
Left,
Right,
Forward,
Backward
};
}
namespace StreamMode
{
enum Enum
{
ClientPull,
ClientPullPreFetch,
ServerPush
};
}
namespace TimecodeStandard
{
enum Enum
{
None,
PAL,
NTSC,
NTSCDrop,
Film
};
}
namespace DeviceType
{
enum Enum
{
Unknown,
ForcePlate,
EyeTracker
};
}
namespace Unit
{
enum Enum
{
Unknown,
Volt,
Newton,
NewtonMeter,
Meter,
Kilogram,
Second,
Ampere,
Kelvin,
Mole,
Candela,
Radian,
Steradian,
MeterSquared,
MeterCubed,
MeterPerSecond,
MeterPerSecondSquared,
RadianPerSecond,
RadianPerSecondSquared,
Hertz,
Joule,
Watt,
Pascal,
Lumen,
Lux,
Coulomb,
Ohm,
Farad,
Weber,
Tesla,
Henry,
Siemens,
Becquerel,
Gray,
Sievert,
Katal
};
}
namespace Result
{
/// The Result code indicates the success or failure of a function.
enum Enum
{
Unknown, ///< The result is unknown. Treat it as a failure.
NotImplemented, ///< The function called has not been implemented in this version of the SDK.
Success, ///< The function call succeeded.
InvalidHostName, ///< The "HostName" parameter passed to Connect() is invalid.
InvalidMulticastIP, ///< The "MulticastIP" parameter was not in the range "224.0.0.0" - "239.255.255.255"
ClientAlreadyConnected, ///< Connect() was called whilst already connected to a DataStream.
ClientConnectionFailed, ///< Connect() could not establish a connection to the DataStream server.
ServerAlreadyTransmittingMulticast, ///< StartTransmittingMulticast() was called when the current DataStream server was already transmitting multicast on behalf of this client.
ServerNotTransmittingMulticast, ///< StopTransmittingMulticast() was called when the current DataStream server was not transmitting multicasr on behalf of this client.
NotConnected, ///< You have called a function which requires a connection to the DataStream server, but do not have a connection.
NoFrame, ///< You have called a function which requires a frame to be fetched from the DataStream server, but do not have a frame.
InvalidIndex, ///< An index you have passed to a function is out of range.
InvalidCameraName, ///< The Camera Name you passed to a function is invalid in this frame.
InvalidSubjectName, ///< The Subject Name you passed to a function is invalid in this frame.
InvalidSegmentName, ///< The Segment Name you passed to a function is invalid in this frame.
InvalidMarkerName, ///< The Marker Name you passed to a function is invalid in this frame.
InvalidDeviceName, ///< The Device Name you passed to a function is invalid in this frame.
InvalidDeviceOutputName, ///< The Device Output Name you passed to a function is invalid in this frame.
InvalidLatencySampleName, ///< The Latency Sample Name you passed to a function is invalid in this frame.
CoLinearAxes, ///< The directions passed to SetAxisMapping() contain input which would cause two or more axis to lie along the same line, e.g. "Up" and "Down" are on the same line.
LeftHandedAxes, ///< The directions passed to SetAxisMapping() would result in a left handed co-ordinate system. This is not supported in the SDK.
HapticAlreadySet ///< Haptic feedback is already set
};
}
/// The version information returned by Client::GetVersion.
class Output_GetVersion
{
public:
/// Major version number of the SDK.
unsigned int Major;
/// Minor version number of the SDK.
unsigned int Minor;
/// Point version number of the SDK.
unsigned int Point;
};
class Output_SimpleResult
{
public:
Result::Enum Result;
};
// Output objects that only return a result enum
class Output_Connect : public Output_SimpleResult {};
class Output_ConnectToMulticast : public Output_SimpleResult {};
class Output_Disconnect : public Output_SimpleResult {};
class Output_StartTransmittingMulticast : public Output_SimpleResult {};
class Output_StopTransmittingMulticast : public Output_SimpleResult {};
class Output_EnableSegmentData : public Output_SimpleResult {};
class Output_EnableMarkerData : public Output_SimpleResult {};
class Output_EnableUnlabeledMarkerData : public Output_SimpleResult {};
class Output_EnableMarkerRayData : public Output_SimpleResult {};
class Output_EnableDeviceData : public Output_SimpleResult {};
class Output_EnableCentroidData : public Output_SimpleResult {};
class Output_EnableGreyscaleData : public Output_SimpleResult {};
class Output_EnableDebugData : public Output_SimpleResult {};
class Output_DisableSegmentData : public Output_SimpleResult {};
class Output_DisableMarkerData : public Output_SimpleResult {};
class Output_DisableUnlabeledMarkerData : public Output_SimpleResult {};
class Output_DisableMarkerRayData : public Output_SimpleResult {};
class Output_DisableDeviceData : public Output_SimpleResult {};
class Output_DisableCentroidData : public Output_SimpleResult {};
class Output_DisableGreyscaleData : public Output_SimpleResult {};
class Output_DisableDebugData : public Output_SimpleResult {};
class Output_SetStreamMode : public Output_SimpleResult {};
class Output_SetApexDeviceFeedback : public Output_SimpleResult {};
class Output_SetAxisMapping : public Output_SimpleResult {};
class Output_GetFrame : public Output_SimpleResult {};
class Output_SetCameraFilter : public Output_SimpleResult {};
class Output_EnabledFlag
{
public:
bool Enabled;
};
// Output objects that only return an enabled flag
class Output_IsSegmentDataEnabled : public Output_EnabledFlag {};
class Output_IsMarkerDataEnabled : public Output_EnabledFlag {};
class Output_IsUnlabeledMarkerDataEnabled : public Output_EnabledFlag {};
class Output_IsMarkerRayDataEnabled : public Output_EnabledFlag {};
class Output_IsDeviceDataEnabled : public Output_EnabledFlag {};
class Output_IsCentroidDataEnabled : public Output_EnabledFlag {};
class Output_IsGreyscaleDataEnabled : public Output_EnabledFlag {};
class Output_IsDebugDataEnabled : public Output_EnabledFlag {};
class Output_IsConnected
{
public:
bool Connected;
};
class Output_GetAxisMapping
{
public:
Direction::Enum XAxis;
Direction::Enum YAxis;
Direction::Enum ZAxis;
};
class Output_GetFrameNumber
{
public:
Result::Enum Result;
unsigned int FrameNumber;
};
class Output_GetTimecode
{
public:
Result::Enum Result;
unsigned int Hours;
unsigned int Minutes;
unsigned int Seconds;
unsigned int Frames;
unsigned int SubFrame;
bool FieldFlag;
TimecodeStandard::Enum Standard;
unsigned int SubFramesPerFrame;
unsigned int UserBits;
};
class Output_GetFrameRate
{
public:
Result::Enum Result;
double FrameRateHz;
};
class Output_GetLatencySampleCount
{
public:
Result::Enum Result;
unsigned int Count;
};
class Output_GetLatencySampleName
{
public:
Result::Enum Result;
String Name;
};
class Output_GetLatencySampleValue
{
public:
Result::Enum Result;
double Value;
};
class Output_GetLatencyTotal
{
public:
Result::Enum Result;
double Total;
};
class Output_GetHardwareFrameNumber
{
public:
Result::Enum Result;
unsigned int HardwareFrameNumber;
};
class Output_GetSubjectCount
{
public:
Result::Enum Result;
unsigned int SubjectCount;
};
class Output_GetSubjectName
{
public:
Result::Enum Result;
String SubjectName;
};
class Output_GetSubjectRootSegmentName
{
public:
Result::Enum Result;
String SegmentName;
};
class Output_GetSegmentChildCount
{
public:
Result::Enum Result;
unsigned int SegmentCount;
};
class Output_GetSegmentChildName
{
public:
Result::Enum Result;
String SegmentName;
};
class Output_GetSegmentParentName
{
public:
Result::Enum Result;
String SegmentName;
};
class Output_GetSegmentCount
{
public:
Result::Enum Result;
unsigned int SegmentCount;
};
class Output_GetSegmentName
{
public:
Result::Enum Result;
String SegmentName;
};
class Output_GetSegmentStaticTranslation
{
public:
Result::Enum Result;
double Translation[ 3 ];
};
class Output_GetSegmentStaticRotationHelical
{
public:
Result::Enum Result;
double Rotation[ 3 ];
};
class Output_GetSegmentStaticRotationMatrix
{
public:
Result::Enum Result;
double Rotation[ 9 ];
};
class Output_GetSegmentStaticRotationQuaternion
{
public:
Result::Enum Result;
double Rotation[ 4 ];
};
class Output_GetSegmentStaticRotationEulerXYZ
{
public:
Result::Enum Result;
double Rotation[ 3 ];
};
class Output_GetSegmentGlobalTranslation
{
public:
Result::Enum Result;
double Translation[ 3 ];
bool Occluded;
};
class Output_GetSegmentGlobalRotationHelical
{
public:
Result::Enum Result;
double Rotation[ 3 ];
bool Occluded;
};
class Output_GetSegmentGlobalRotationMatrix
{
public:
Result::Enum Result;
double Rotation[ 9 ];
bool Occluded;
};
class Output_GetSegmentGlobalRotationQuaternion
{
public:
Result::Enum Result;
double Rotation[ 4 ];
bool Occluded;
};
class Output_GetSegmentGlobalRotationEulerXYZ
{
public:
Result::Enum Result;
double Rotation[ 3 ];
bool Occluded;
};
class Output_GetSegmentLocalTranslation
{
public:
Result::Enum Result;
double Translation[ 3 ];
bool Occluded;
};
class Output_GetSegmentLocalRotationHelical
{
public:
Result::Enum Result;
double Rotation[ 3 ];
bool Occluded;
};
class Output_GetSegmentLocalRotationMatrix
{
public:
Result::Enum Result;
double Rotation[ 9 ];
bool Occluded;
};
class Output_GetSegmentLocalRotationQuaternion
{
public:
Result::Enum Result;
double Rotation[ 4 ];
bool Occluded;
};
class Output_GetSegmentLocalRotationEulerXYZ
{
public:
Result::Enum Result;
double Rotation[ 3 ];
bool Occluded;
};
class Output_GetMarkerCount
{
public:
Result::Enum Result;
unsigned int MarkerCount;
};
class Output_GetMarkerName
{
public:
Result::Enum Result;
String MarkerName;
};
class Output_GetMarkerParentName
{
public:
Result::Enum Result;
String SegmentName;
};
class Output_GetMarkerGlobalTranslation
{
public:
Result::Enum Result;
double Translation[ 3 ];
bool Occluded;
};
class Output_GetMarkerRayContributionCount
{
public:
Result::Enum Result;
unsigned int RayContributionsCount;
};
class Output_GetMarkerRayContribution
{
public:
Result::Enum Result;
unsigned int CameraID;
unsigned int CentroidIndex;