cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsHistory.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  $Id: mtsHistory.h 2009-03-02 mjung5
6 
7  Author(s): Min Yang Jung
8  Created on: 2009-03-25
9 
10  (C) Copyright 2009 Johns Hopkins University (JHU), All Rights
11  Reserved.
12 
13 --- begin cisst license - do not edit ---
14 
15 This software is provided "as is" under an open source license, with
16 no warranty. The complete license can be found in license.txt and
17 http://www.cisst.org/cisst/license.txt.
18 
19 --- end cisst license ---
20 
21 */
22 
28 #error "This file has been deprecated, there is no replacement for the class mtsHistory. adeguet1, 2013/06/24"
29 
30 #ifndef _mtsHistory_h
31 #define _mtsHistory_h
32 
35 
37 
42 {
43  friend class mtsHistoryBaseTest;
44 
45 public:
47  mtsHistoryBase(const mtsHistoryBase & other) : mtsGenericObject(other) {}
48  virtual ~mtsHistoryBase() {}
49 
51  virtual void SetHistorySize(const int historySize) = 0;
52 
53  // Methods to be used by GetHistory() (maybe: [], ...)
54 };
55 
56 template <class _elementType>
57 class mtsHistory : public mtsHistoryBase,
58  public vctDynamicVector<_elementType>
59 {
60  CMN_DECLARE_SERVICES_EXPORT(CMN_DYNAMIC_CREATION, CMN_LOG_ALLOW_DEFAULT);
61 
62 public:
64  typedef _elementType value_type;
65 
68 
71 
73  typedef typename VectorType::size_type size_type;
74 
76  inline mtsHistory(void) : VectorType(0) {}
77 
79  inline mtsHistory(size_type size) : VectorType(size) {}
80 
82  inline void SetHistorySize(const int historySize) {
83  this->SetSize(historySize);
84  }
85 
89  inline ThisType & operator=(const VectorType & data) {
90  VectorType::Assign(data);
91  return *this;
92  }
93 
95  inline mtsHistory(const ThisType & otherVector):
96  mtsHistoryBase(otherVector),
97  VectorType(otherVector)
98  {}
99 
102  inline ~mtsHistory() {}
103 
105  virtual std::string ToString(void) const {
106  std::stringstream outputStream;
107  VectorType::ToStream(outputStream);
108  return outputStream.str();
109  }
110 
112  virtual void ToStream(std::ostream & outputStream) const {
113  VectorType::ToStream(outputStream);
114  }
115 
117  virtual void ToStreamRaw(std::ostream & outputStream, const char delimiter = ' ',
118  bool headerOnly = false, const std::string & headerPrefix = "") const {
119  mtsGenericObject::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
120  outputStream << delimiter;
121  VectorType::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
122  }
123 };
124 
125 // PK: the StateTable GetHistory implementation will require an mtsVector
126 // for every parameter type!!
127 
128 // Following is for a vector of cmnDouble
131 
132 // Following is for a vector of cmnVector<double>
135 
136 #endif // _mtsHistory_h
mtsHistoryBase()
Definition: mtsHistory.h:46
A vector object of dynamic size.
Definition: vctDynamicVector.h:127
VectorType::size_type size_type
Definition: mtsHistory.h:73
Definition: mtsHistory.h:41
ThisType & Assign(const vctDynamicConstVectorBase< __vectorOwnerType, value_type > &other)
Definition: vctDynamicVectorBase.h:242
size_t size_type
Definition: vctContainerTraits.h:35
Base class for data object in cisstMultiTask.
Definition: mtsGenericObject.h:56
virtual ~mtsHistoryBase()
Definition: mtsHistory.h:48
mtsHistoryBase(const mtsHistoryBase &other)
Definition: mtsHistory.h:47
mtsHistory< mtsDoubleVec > mtsDoubleVecHistory
Definition: mtsHistory.h:133
virtual std::string ToString(void) const
Definition: mtsHistory.h:105
_elementType value_type
Definition: mtsHistory.h:64
void SetSize(size_type size)
Definition: vctDynamicVector.h:315
mtsHistory< value_type > ThisType
Definition: mtsHistory.h:67
Declaration of vctDynamicVector.
size_type size(void) const
Definition: vctDynamicConstVectorBase.h:164
void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: vctDynamicConstVectorBase.h:973
virtual void SetHistorySize(const int historySize)=0
ThisType & operator=(const VectorType &data)
Definition: mtsHistory.h:89
~mtsHistory()
Definition: mtsHistory.h:102
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition: mtsHistory.h:117
virtual void ToStream(std::ostream &outputStream) const
Definition: mtsHistory.h:112
void ToStream(std::ostream &outputStream) const
Definition: vctDynamicConstVectorBase.h:950
Definition: vctDynamicConstVectorBase.h:77
Rules of exporting.
mtsHistory(size_type size)
Definition: mtsHistory.h:79
mtsHistory(void)
Definition: mtsHistory.h:76
vctDynamicVector< value_type > VectorType
Definition: mtsHistory.h:70
const int CMN_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:331
Definition: mtsHistory.h:57
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
CMN_DECLARE_SERVICES_INSTANTIATION(mtsDoubleHistory)
mtsHistory(const ThisType &otherVector)
Definition: mtsHistory.h:95
void SetHistorySize(const int historySize)
Definition: mtsHistory.h:82
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
mtsHistory< mtsDouble > mtsDoubleHistory
Definition: mtsHistory.h:129
friend class mtsHistoryBaseTest
Definition: mtsHistory.h:43