vicon
Client.h
Go to the documentation of this file.
1 //
3 // Copyright (C) OMG Plc 2009.
4 // All rights reserved. This software is protected by copyright
5 // law and international treaties. No part of this software / document
6 // may be reproduced or distributed in any form or by any means,
7 // whether transiently or incidentally to some other use of this software,
8 // without the written permission of the copyright owner.
9 //
11 #pragma once
12 
13 #ifdef WIN32
14 
15 #ifdef _EXPORTING
16  #define CLASS_DECLSPEC __declspec(dllexport)
17 #else
18  #define CLASS_DECLSPEC __declspec(dllimport)
19 #endif // _EXPORTING
20 
21 #elif defined( __GNUC__ )
22 
23 #if __GNUC__ < 4
24  #error gcc 4 is required.
25  #endif
26  #define CLASS_DECLSPEC __attribute__((visibility("default")))
27 
28 #else
29 
30 #define CLASS_DECLSPEC
31 
32 #endif
33 
34 #include <string>
35 
36 namespace ViconDataStreamSDK
37 {
38 namespace CPP
39 {
40 
42 {
43 public:
44  virtual char * AllocAndCopyString( const char * i_pSource ) = 0;
45  virtual void FreeString( char * i_pString ) = 0;
46 protected:
47  virtual ~IStringFactory() {}
48 };
49 
50 class String
51 {
52 public:
53  // A string which we are not responsible for deallocating
54  inline
55  String( const char * i_pString = 0 )
56  : m_pString( 0 )
57  , m_pConstString( i_pString )
58  , m_pStringFactory( 0 )
59  {
60  }
61 
62  // A string which we are not responsible for deallocating
63  String( const std::string & i_rString )
64  : m_pString( 0 )
65  , m_pConstString( i_rString.c_str() )
66  , m_pStringFactory( 0 )
67  {
68  }
69 
70  // Copy constructor
71  inline
72  String( const String & i_rString )
73  {
74  m_pConstString = i_rString.m_pConstString;
75  m_pStringFactory = i_rString.m_pStringFactory;
76  if( m_pStringFactory )
77  {
78  m_pString = m_pStringFactory->AllocAndCopyString( i_rString.m_pString );
79  }
80  else
81  {
82  m_pString = 0;
83  }
84  }
85 
86  inline
88  {
89  if( m_pStringFactory )
90  {
91  m_pStringFactory->FreeString( m_pString );
92  }
93  }
94 
95  // A string which we are responsible for deallocating
96  inline
97  void Set( const char * i_pString, IStringFactory & i_rStringFactory )
98  {
99  m_pString = i_rStringFactory.AllocAndCopyString( i_pString );
100  m_pStringFactory = &i_rStringFactory;
101  m_pConstString = 0;
102  }
103 
104  inline
105  operator std::string() const
106  {
107  if( m_pStringFactory )
108  {
109  return std::string( m_pString );
110  }
111  else
112  {
113  return std::string( m_pConstString );
114  }
115  }
116 
117 private:
118  char * m_pString;
119  const char * m_pConstString;
120  IStringFactory * m_pStringFactory;
121 };
122 
123 // Streaming operator for String
124 std::ostream & operator<<( std::ostream & io_rStream, const String & i_rString )
125 {
126  io_rStream << std::string( i_rString );
127  return io_rStream;
128 }
129 
130 namespace Direction
131 {
132  enum Enum
133  {
134  Up,
140  };
141 }
142 
143 namespace StreamMode
144 {
145  enum Enum
146  {
150  };
151 }
152 
153 namespace TimecodeStandard
154 {
155  enum Enum
156  {
162  };
163 }
164 
165 namespace DeviceType
166 {
167  enum Enum
168  {
171  };
172 }
173 
174 namespace Unit
175 {
176  enum Enum
177  {
183  };
184 }
185 
186 namespace Result
187 {
188  enum Enum
189  {
210  };
211 }
212 
214  {
215  public:
216  unsigned int Major;
217  unsigned int Minor;
218  unsigned int Point;
219  };
220 
222  {
223  public:
225  };
226 
228  {
229  public:
231  };
232 
234  {
235  public:
237  };
238 
240  {
241  public:
242  bool Connected;
243  };
244 
246  {
247  public:
249  };
250 
252  {
253  public:
255  };
256 
258  {
259  public:
261  };
262 
264  {
265  public:
267  };
268 
270  {
271  public:
273  };
274 
276  {
277  public:
279  };
280 
282  {
283  public:
285  };
286 
288  {
289  public:
291  };
292 
294  {
295  public:
297  };
298 
300  {
301  public:
303  };
304 
306  {
307  public:
308  bool Enabled;
309  };
310 
312  {
313  public:
314  bool Enabled;
315  };
316 
318  {
319  public:
320  bool Enabled;
321  };
322 
324  {
325  public:
326  bool Enabled;
327  };
328 
330  {
331  public:
333  };
334 
336  {
337  public:
339  };
340 
342  {
343  public:
347  };
348 
350  {
351  public:
353  };
354 
356  {
357  public:
359  unsigned int FrameNumber;
360  };
361 
363  {
364  public:
366  unsigned int Hours;
367  unsigned int Minutes;
368  unsigned int Seconds;
369  unsigned int Frames;
370  unsigned int SubFrame;
371  bool FieldFlag;
373  unsigned int SubFramesPerFrame;
374  unsigned int UserBits;
375  };
376 
378  {
379  public:
381  unsigned int Count;
382  };
383 
385  {
386  public:
389  };
390 
392  {
393  public:
395  double Value;
396  };
397 
399  {
400  public:
402  double Total;
403  };
404 
406  {
407  public:
409  unsigned int SubjectCount;
410  };
411 
413  {
414  public:
417  };
418 
420  {
421  public:
424  };
425 
427  {
428  public:
430  unsigned int SegmentCount;
431  };
432 
434  {
435  public:
438  };
439 
441  {
442  public:
445  };
446 
448  {
449  public:
451  unsigned int SegmentCount;
452  };
453 
455  {
456  public:
459  };
460 
462  {
463  public:
465  double Translation[ 3 ];
466  };
467 
469  {
470  public:
472  double Rotation[ 3 ];
473  };
474 
476  {
477  public:
479  double Rotation[ 9 ];
480  };
481 
483  {
484  public:
486  double Rotation[ 4 ];
487  };
488 
490  {
491  public:
493  double Rotation[ 3 ];
494  };
495 
497  {
498  public:
500  double Translation[ 3 ];
501  bool Occluded;
502  };
503 
505  {
506  public:
508  double Rotation[ 3 ];
509  bool Occluded;
510  };
511 
513  {
514  public:
516  double Rotation[ 9 ];
517  bool Occluded;
518  };
519 
521  {
522  public:
524  double Rotation[ 4 ];
525  bool Occluded;
526  };
527 
529  {
530  public:
532  double Rotation[ 3 ];
533  bool Occluded;
534  };
535 
537  {
538  public:
540  double Translation[ 3 ];
541  bool Occluded;
542  };
543 
545  {
546  public:
548  double Rotation[ 3 ];
549  bool Occluded;
550  };
551 
553  {
554  public:
556  double Rotation[ 9 ];
557  bool Occluded;
558  };
559 
561  {
562  public:
564  double Rotation[ 4 ];
565  bool Occluded;
566  };
567 
569  {
570  public:
572  double Rotation[ 3 ];
573  bool Occluded;
574  };
575 
577  {
578  public:
580  unsigned int MarkerCount;
581  };
582 
584  {
585  public:
588  };
589 
591  {
592  public:
595  };
596 
598  {
599  public:
601  double Translation[ 3 ];
602  bool Occluded;
603  };
604 
606  {
607  public:
609  unsigned int MarkerCount;
610  };
611 
613  {
614  public:
616  double Translation[ 3 ];
617  };
618 
620  {
621  public:
623  unsigned int DeviceCount;
624  };
625 
627  {
628  public:
632  };
633 
635  {
636  public:
638  unsigned int DeviceOutputCount;
639  };
640 
642  {
643  public:
647  };
648 
650  {
651  public:
653  double Value;
654  bool Occluded;
655  };
656 
657 
658  class ClientImpl;
659 
661  {
662  public:
663  Client();
664  ~Client();
665 
666  Output_GetVersion GetVersion() const;
667 
668  Output_Connect Connect( const String & HostName );
669  Output_ConnectToMulticast ConnectToMulticast( const String & HostName, const String & MulticastIP );
670  Output_Disconnect Disconnect();
671  Output_IsConnected IsConnected() const;
672  Output_StartTransmittingMulticast StartTransmittingMulticast( const String & ServerIP,
673  const String & MulticastIP );
674 
675  Output_StopTransmittingMulticast StopTransmittingMulticast();
676 
677  Output_EnableSegmentData EnableSegmentData();
678  Output_EnableMarkerData EnableMarkerData();
679  Output_EnableUnlabeledMarkerData EnableUnlabeledMarkerData();
680  Output_EnableDeviceData EnableDeviceData();
681 
682  Output_DisableSegmentData DisableSegmentData();
683  Output_DisableMarkerData DisableMarkerData();
684  Output_DisableUnlabeledMarkerData DisableUnlabeledMarkerData();
685  Output_DisableDeviceData DisableDeviceData();
686 
687  Output_IsSegmentDataEnabled IsSegmentDataEnabled() const;
688  Output_IsMarkerDataEnabled IsMarkerDataEnabled() const;
689  Output_IsUnlabeledMarkerDataEnabled IsUnlabeledMarkerDataEnabled() const;
690  Output_IsDeviceDataEnabled IsDeviceDataEnabled() const;
691 
692  Output_SetStreamMode SetStreamMode( const StreamMode::Enum Mode );
693 
694  Output_SetAxisMapping SetAxisMapping( const Direction::Enum XAxis, const Direction::Enum YAxis, const Direction::Enum ZAxis );
695  Output_GetAxisMapping GetAxisMapping() const;
696 
697  Output_GetFrame GetFrame();
698  Output_GetFrameNumber GetFrameNumber() const;
699 
700  Output_GetTimecode GetTimecode() const;
701 
702  Output_GetLatencySampleCount GetLatencySampleCount() const;
703  Output_GetLatencySampleName GetLatencySampleName( const unsigned int LatencySampleIndex ) const;
704  Output_GetLatencySampleValue GetLatencySampleValue( const String & LatencySampleName ) const;
705  Output_GetLatencyTotal GetLatencyTotal() const;
706 
707  Output_GetSubjectCount GetSubjectCount() const;
708  Output_GetSubjectName GetSubjectName( const unsigned int SubjectIndex ) const;
709 
710  Output_GetSubjectRootSegmentName GetSubjectRootSegmentName( const String & SubjectName ) const;
711 
712  Output_GetSegmentCount GetSegmentCount( const String & SubjectName ) const;
713 
714  Output_GetSegmentName GetSegmentName( const String & SubjectName,
715  const unsigned int SegmentIndex ) const;
716 
717  Output_GetSegmentChildCount GetSegmentChildCount( const String & SubjectName,
718  const String & SegmentName ) const;
719 
720  Output_GetSegmentChildName GetSegmentChildName( const String & SubjectName,
721  const String & SegmentName,
722  const unsigned int SegmentIndex ) const;
723 
724  Output_GetSegmentParentName GetSegmentParentName( const String & SubjectName,
725  const String & SegmentName ) const;
726 
727  Output_GetSegmentStaticTranslation GetSegmentStaticTranslation( const String & SubjectName,
728  const String & SegmentName ) const;
729 
730  Output_GetSegmentStaticRotationHelical GetSegmentStaticRotationHelical( const String & SubjectName,
731  const String & SegmentName ) const;
732 
733  Output_GetSegmentStaticRotationMatrix GetSegmentStaticRotationMatrix( const String & SubjectName,
734  const String & SegmentName ) const;
735 
736  Output_GetSegmentStaticRotationQuaternion GetSegmentStaticRotationQuaternion( const String & SubjectName,
737  const String & SegmentName ) const;
738 
739  Output_GetSegmentStaticRotationEulerXYZ GetSegmentStaticRotationEulerXYZ( const String & SubjectName,
740  const String & SegmentName ) const;
741 
742  Output_GetSegmentGlobalTranslation GetSegmentGlobalTranslation( const String & SubjectName,
743  const String & SegmentName ) const;
744 
745  Output_GetSegmentGlobalRotationHelical GetSegmentGlobalRotationHelical( const String & SubjectName,
746  const String & SegmentName ) const;
747 
748  Output_GetSegmentGlobalRotationMatrix GetSegmentGlobalRotationMatrix( const String & SubjectName,
749  const String & SegmentName ) const;
750 
751  Output_GetSegmentGlobalRotationQuaternion GetSegmentGlobalRotationQuaternion( const String & SubjectName,
752  const String & SegmentName ) const;
753 
754  Output_GetSegmentGlobalRotationEulerXYZ GetSegmentGlobalRotationEulerXYZ( const String & SubjectName,
755  const String & SegmentName ) const;
756 
757  Output_GetSegmentLocalTranslation GetSegmentLocalTranslation( const String & SubjectName,
758  const String & SegmentName ) const;
759 
760  Output_GetSegmentLocalRotationHelical GetSegmentLocalRotationHelical( const String & SubjectName,
761  const String & SegmentName ) const;
762 
763  Output_GetSegmentLocalRotationMatrix GetSegmentLocalRotationMatrix( const String & SubjectName,
764  const String & SegmentName ) const;
765 
766  Output_GetSegmentLocalRotationQuaternion GetSegmentLocalRotationQuaternion( const String & SubjectName,
767  const String & SegmentName ) const;
768 
769  Output_GetSegmentLocalRotationEulerXYZ GetSegmentLocalRotationEulerXYZ( const String & SubjectName,
770  const String & SegmentName ) const;
771 
772  Output_GetMarkerCount GetMarkerCount( const String & SubjectName ) const;
773 
774  Output_GetMarkerName GetMarkerName( const String & SubjectName,
775  const unsigned int MarkerIndex ) const;
776 
777  Output_GetMarkerParentName GetMarkerParentName( const String & SubjectName,
778  const String & MarkerName ) const;
779 
780  Output_GetMarkerGlobalTranslation GetMarkerGlobalTranslation( const String & SubjectName,
781  const String & MarkerName ) const;
782 
783 
784  Output_GetUnlabeledMarkerCount GetUnlabeledMarkerCount() const;
785 
786  Output_GetUnlabeledMarkerGlobalTranslation GetUnlabeledMarkerGlobalTranslation( const unsigned int MarkerIndex ) const;
787 
788  Output_GetDeviceCount GetDeviceCount() const;
789  Output_GetDeviceName GetDeviceName( const unsigned int DeviceIndex ) const;
790 
791  Output_GetDeviceOutputCount GetDeviceOutputCount( const String & DeviceName ) const;
792 
793  Output_GetDeviceOutputName GetDeviceOutputName( const String & DeviceName,
794  const unsigned int DeviceOutputIndex ) const;
795 
796  Output_GetDeviceOutputValue GetDeviceOutputValue( const String & DeviceName,
797  const String & DeviceOutputName ) const;
798  private:
799  ClientImpl * m_pClientImpl;
800  };
801 } // End of namespace CPP
802 } // End of namespace ViconDataStreamSDK
String(const String &i_rString)
Definition: Client.h:72
void Set(const char *i_pString, IStringFactory &i_rStringFactory)
Definition: Client.h:97
String(const char *i_pString=0)
Definition: Client.h:55
#define CLASS_DECLSPEC
Definition: Client.h:30
std::ostream & operator<<(std::ostream &io_rStream, const String &i_rString)
Definition: Client.h:124
String(const std::string &i_rString)
Definition: Client.h:63
virtual void FreeString(char *i_pString)=0
virtual char * AllocAndCopyString(const char *i_pSource)=0