cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsFixedSizeVector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2010-02-27
8 
9  (C) Copyright 2010 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 
22 #ifndef _mtsFixedSizeVector_h
23 #define _mtsFixedSizeVector_h
24 
28 
29 // Always include last
31 
32 template <class _elementType, vct::size_type _size>
34  public vctFixedSizeVector<_elementType, _size> {
35  // declare services, requires dynamic creation
36  CMN_DECLARE_SERVICES_EXPORT(CMN_DYNAMIC_CREATION, CMN_LOG_ALLOW_DEFAULT);
37 public:
38  /* defines useful types */
39  VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType);
40 
43 
46 
48  inline mtsFixedSizeVector(void)
49  {
51  }
52 
55  inline ThisType & operator = (const VectorType & data) {
56  VectorType::Assign(data);
57  return *this;
58  }
59 
61  inline mtsFixedSizeVector(const ThisType & otherVector):
62  mtsGenericObject(otherVector),
63  VectorType(otherVector)
64  {}
65 
67  inline mtsFixedSizeVector(const VectorType & otherVector):
69  VectorType(otherVector)
70  {}
71 
74  inline ~mtsFixedSizeVector() {}
75 
77  virtual std::string ToString(void) const {
78  std::stringstream outputStream;
79  this->ToStream(outputStream);
80  return outputStream.str();
81  }
82 
84  virtual void ToStream(std::ostream & outputStream) const {
85  mtsGenericObject::ToStream(outputStream);
86  outputStream << std::endl;
87  VectorType::ToStream(outputStream);
88  }
89 
91  inline virtual void ToStreamRaw(std::ostream & outputStream, const char delimiter = ' ',
92  bool headerOnly = false, const std::string & headerPrefix = "") const {
93  mtsGenericObject::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
94  outputStream << delimiter;
95  VectorType::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
96  }
97 
99  void SerializeRaw(std::ostream & outputStream) const
100  {
101  mtsGenericObject::SerializeRaw(outputStream);
102  VectorType::SerializeRaw(outputStream);
103  }
104 
106  void DeSerializeRaw(std::istream & inputStream)
107  {
109  VectorType::DeSerializeRaw(inputStream);
110  }
111 
112 };
113 
114 
115 #endif // _mtsFixedSizeVector_h
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: mtsFixedSizeVector.h:91
mtsFixedSizeVector(const VectorType &otherVector)
Definition: mtsFixedSizeVector.h:67
virtual void ToStream(std::ostream &outputStream) const
Definition: mtsFixedSizeVector.h:84
Definition: mtsFixedSizeVector.h:33
void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: vctFixedSizeConstVectorBase.h:1118
virtual void SerializeRaw(std::ostream &outputStream) const
void SerializeRaw(std::ostream &outputStream) const
Definition: vctFixedSizeConstVectorBase.h:1141
virtual void DeSerializeRaw(std::istream &inputStream)
virtual void ToStream(std::ostream &outputStream) const
ThisType & operator=(const VectorType &data)
Definition: mtsFixedSizeVector.h:55
Class register definitions and log macros.
Base class for data object in cisstMultiTask.
Definition: mtsGenericObject.h:56
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition: vctFixedSizeVectorBase.h:274
~mtsFixedSizeVector()
Definition: mtsFixedSizeVector.h:74
Implementation of a fixed-size vector using template metaprogramming.
Definition: vctFixedSizeVector.h:52
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
void SerializeRaw(std::ostream &outputStream) const
Definition: mtsFixedSizeVector.h:99
mtsFixedSizeVector(const ThisType &otherVector)
Definition: mtsFixedSizeVector.h:61
Declaration of vctFixedSizeVector.
Forward declarations and #define for cisstMultiTask.
mtsFixedSizeVector< value_type, _size > ThisType
Definition: mtsFixedSizeVector.h:42
void DeSerializeRaw(std::istream &inputStream)
Definition: vctFixedSizeVector.h:299
virtual std::string ToString(void) const
Definition: mtsFixedSizeVector.h:77
A template for a fixed length vector with fixed spacing in memory.
Definition: vctFixedSizeConstVectorBase.h:107
Rules of exporting.
mtsFixedSizeVector(void)
Definition: mtsFixedSizeVector.h:48
void DeSerializeRaw(std::istream &inputStream)
Definition: mtsFixedSizeVector.h:106
void ToStream(std::ostream &outputStream) const
Definition: vctFixedSizeConstVectorBase.h:1096
const int CMN_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:331
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
vctFixedSizeVector< value_type, _size > VectorType
Definition: mtsFixedSizeVector.h:45
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76