cisst-saw
Loading...
Searching...
No Matches
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 Author(s): Anton Deguet
6 Created on: 2010-02-27
7
8 (C) Copyright 2010-2023 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19
20#ifndef _mtsFixedSizeVector_h
21#define _mtsFixedSizeVector_h
22
26
27// Always include last
29
30template <class _elementType, vct::size_type _size>
32 public vctFixedSizeVector<_elementType, _size> {
33 // declare services, requires dynamic creation
34 CMN_DECLARE_SERVICES_EXPORT(CMN_DYNAMIC_CREATION, CMN_LOG_ALLOW_DEFAULT);
35public:
36 /* defines useful types */
38
41
44
46 inline mtsFixedSizeVector(void)
47 {
49 }
50
53 inline ThisType & operator = (const VectorType & data) {
55 return *this;
56 }
57
59 inline mtsFixedSizeVector(const ThisType & otherVector):
60 mtsGenericObject(otherVector),
61 VectorType(otherVector)
62 {}
63
65 inline mtsFixedSizeVector(const VectorType & otherVector):
67 VectorType(otherVector)
68 {}
69
73
75 virtual std::string ToString(void) const {
76 std::stringstream outputStream;
77 this->ToStream(outputStream);
78 return outputStream.str();
79 }
80
82 void ToStream(std::ostream & outputStream) const override {
83 mtsGenericObject::ToStream(outputStream);
84 outputStream << std::endl;
85 VectorType::ToStream(outputStream);
86 }
87
89 void ToStreamRaw(std::ostream & outputStream, const char delimiter = ' ',
90 bool headerOnly = false, const std::string & headerPrefix = "") const override {
91 mtsGenericObject::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
92 outputStream << delimiter;
93 VectorType::ToStreamRaw(outputStream, delimiter, headerOnly, headerPrefix);
94 }
95
97 void SerializeRaw(std::ostream & outputStream) const override
98 {
100 VectorType::SerializeRaw(outputStream);
101 }
102
104 void DeSerializeRaw(std::istream & inputStream) override
105 {
107 VectorType::DeSerializeRaw(inputStream);
108 }
109
110};
111
112
113#endif // _mtsFixedSizeVector_h
void SerializeRaw(std::ostream &outputStream) const override
Definition mtsFixedSizeVector.h:97
ThisType & operator=(const VectorType &data)
Definition mtsFixedSizeVector.h:53
mtsFixedSizeVector(const VectorType &otherVector)
Definition mtsFixedSizeVector.h:65
void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const override
Definition mtsFixedSizeVector.h:89
mtsFixedSizeVector(void)
Definition mtsFixedSizeVector.h:46
void ToStream(std::ostream &outputStream) const override
Definition mtsFixedSizeVector.h:82
~mtsFixedSizeVector()
Definition mtsFixedSizeVector.h:72
virtual std::string ToString(void) const
Definition mtsFixedSizeVector.h:75
mtsFixedSizeVector(const ThisType &otherVector)
Definition mtsFixedSizeVector.h:59
VCT_CONTAINER_TRAITS_TYPEDEFS(_elementType)
vctFixedSizeVector< value_type, _size > VectorType
Definition mtsFixedSizeVector.h:43
void DeSerializeRaw(std::istream &inputStream) override
Definition mtsFixedSizeVector.h:104
mtsFixedSizeVector< value_type, _size > ThisType
Definition mtsFixedSizeVector.h:40
virtual void SerializeRaw(std::ostream &outputStream) const
virtual void ToStream(std::ostream &outputStream) const
mtsGenericObject(void)
Definition mtsGenericObject.h:77
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const
virtual void DeSerializeRaw(std::istream &inputStream)
void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const
Definition vctFixedSizeConstVectorBase.h:1118
void SerializeRaw(std::ostream &outputStream) const
Definition vctFixedSizeConstVectorBase.h:1141
VectorValueType Normalized(void) const CISST_THROW(std void ToStream(std::ostream &outputStream) const
Definition vctFixedSizeConstVectorBase.h:1096
ThisType & Assign(const vctFixedSizeConstVectorBase< _size, __stride, __elementType, __dataPtrType > &other)
Definition vctFixedSizeVectorBase.h:274
bool Zeros(void)
Definition vctFixedSizeVectorBase.h:256
vctFixedSizeVector()
Definition vctFixedSizeVector.h:76
void DeSerializeRaw(std::istream &inputStream)
Definition vctFixedSizeVector.h:301
Class register definitions and log macros.
const int CMN_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:328
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
Rules of exporting.
Forward declarations and #define for cisstMultiTask.
Declaration of vctFixedSizeVector.