File: igtlMessageFormat2TestMacro.h

package info (click to toggle)
openigtlink 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,080 kB
  • sloc: cpp: 20,076; ansic: 6,704; sh: 227; perl: 74; makefile: 46
file content (53 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*=========================================================================

  Program:   The OpenIGTLink Library
  Language:  C++
  Web page:  http://openigtlink.org/

  Copyright (c) Insight Software Consortium. All rights reserved.

  This software is distributed WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#ifndef __igltMessageFormat2TestMarco_h
#define __igltMessageFormat2TestMarco_h

#include <igtl_types.h>

#define EXTENDED_CONTENT_SIZE 69 // the extended content size variable sums up the size of the Extended header, meta data header and meta data.


#define igtlMetaDataAddElementMacro(object) \
  object->SetHeaderVersion(IGTL_HEADER_VERSION_2);\
  IANA_ENCODING_TYPE codingScheme = IANA_TYPE_US_ASCII; /* 3 corresponding to US-ASCII */ \
  object->SetMetaDataElement("First patient age", codingScheme, "22");\
  object->SetMetaDataElement("Second patient age",codingScheme, "25");\
  object->SetMessageID(1);

#define igtlMetaDataComparisonMacro(object) \
  std::vector<std::string> groundTruth(0); \
  groundTruth.push_back("First patient age");\
  groundTruth.push_back("Second patient age");\
  \
  std::vector<std::string> groundTruthAge(0);\
  groundTruthAge.push_back("22");\
  groundTruthAge.push_back("25");\
  \
  EXPECT_EQ(object->GetMessageID(),1);\
  \
  \
  int i = 0;\
  for (igtl::MessageBase::MetaDataMap::const_iterator it = object->GetMetaData().begin(); it != object->GetMetaData().end(); ++it, ++i)\
  {\
    EXPECT_STREQ(it->first.c_str(), groundTruth[i].c_str());\
    EXPECT_EQ(it->second.first, IANA_TYPE_US_ASCII);\
    EXPECT_STREQ(it->second.second.c_str(), groundTruthAge[i].c_str());\
  }


#endif // __igltMessageFormat2TestMarco_h