GenApi 3.5.1
ConcatenatedWrite.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2017 by Teledyne DALSA
3// Author: Eric Bourbonnais
4//
5// License: This file is published under the license of the EMVA GenICam Standard Group.
6// A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7// If for some reason you are missing this file please contact the EMVA or visit the website
8// (http://www.genicam.org) for a full copy.
9//
10// THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20// POSSIBILITY OF SUCH DAMAGE.
21//
22//-----------------------------------------------------------------------------
29#ifndef GENAPI_NODE_WRITE_CONCATENATOR_H
30#define GENAPI_NODE_WRITE_CONCATENATOR_H
31
32namespace GENAPI_NAMESPACE
33{
34
35 class GENAPI_DECL CNodeWriteConcatenator
36 {
37 protected:
39 virtual ~CNodeWriteConcatenator(void) = 0;
40 public:
42 virtual void Add(const GENICAM_NAMESPACE::gcstring &nodeName, const GENICAM_NAMESPACE::gcstring &nodeValue) = 0;
44 virtual void Add(const GENICAM_NAMESPACE::gcstring &nodeName, const char *) = 0;
46 virtual void Add(const GENICAM_NAMESPACE::gcstring &nodeName, const int64_t nodeValue) = 0;
48 virtual void Add(const GENICAM_NAMESPACE::gcstring &nodeName, const double nodeValue) = 0;
50 virtual void Add(const GENICAM_NAMESPACE::gcstring &nodeName, const bool nodeValue) = 0;
52 virtual void Clear() = 0;
54 virtual void Destroy() = 0;
55 };
56
61 class GENAPI_DECL CNodeWriteConcatenatorRef
62 {
63 public:
65 CNodeWriteConcatenatorRef() : m_pConcatenator(NULL)
66 {
67 };
69 CNodeWriteConcatenatorRef(CNodeWriteConcatenator *pConcatenator) : m_pConcatenator(pConcatenator)
70 {
71 };
74 {
75 if (m_pConcatenator)
76 m_pConcatenator->Destroy();
77 m_pConcatenator = NULL;
78
79 }
80
82 void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const GENICAM_NAMESPACE::gcstring &nodeValue)
83 {
84 if (m_pConcatenator)
85 m_pConcatenator->Add(nodeName, nodeValue);
86 else
87 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
88 }
90 void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const char *nodeValue)
91 {
92 if (m_pConcatenator)
93 m_pConcatenator->Add(nodeName, nodeValue);
94 else
95 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
96 }
98 void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const int64_t nodeValue)
99 {
100 if (m_pConcatenator)
101 m_pConcatenator->Add(nodeName, nodeValue);
102 else
103 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
104 }
106 void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const double nodeValue)
107 {
108 if (m_pConcatenator)
109 m_pConcatenator->Add(nodeName, nodeValue);
110 else
111 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
112 }
114 void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const bool nodeValue)
115 {
116 if (m_pConcatenator)
117 m_pConcatenator->Add(nodeName, nodeValue);
118 else
119 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
120 }
122 void _Clear()
123 {
124 if (m_pConcatenator)
125 m_pConcatenator->Clear();
126 else
127 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
128 }
130 CNodeWriteConcatenator *Release()
131 {
132 CNodeWriteConcatenator *tmp = m_pConcatenator;
133 m_pConcatenator = NULL;
134 return tmp;
135 }
137 operator CNodeWriteConcatenator * () const
138 {
139 if (m_pConcatenator)
140 return m_pConcatenator;
141 else
142 throw ACCESS_EXCEPTION("Concatenator not present (reference not valid)");
143 }
145 CNodeWriteConcatenator *get() const
146 {
147 return m_pConcatenator;
148 }
149
151 CNodeWriteConcatenatorRef& operator = (CNodeWriteConcatenator *pConcatenator)
152 {
153
154 if (m_pConcatenator)
155 m_pConcatenator->Destroy();
156 // Take ownership of the object
157 m_pConcatenator = pConcatenator;
158 return *this;
159 }
160
161 private:
162 CNodeWriteConcatenator *m_pConcatenator;
163 };
164
165}
166
167#endif // GENAPI_NODE_WRITE_CONCATENATOR_H
Reference object for CNodeWriteConcatenator create with NewNodeWriteConcatenator function of nodemap ...
Definition ConcatenatedWrite.h:62
CNodeWriteConcatenatorRef(CNodeWriteConcatenator *pConcatenator)
Constructor.
Definition ConcatenatedWrite.h:69
void _Clear()
Remove all write from the container.
Definition ConcatenatedWrite.h:122
void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const GENICAM_NAMESPACE::gcstring &nodeValue)
Add a write with value of type gcstring.
Definition ConcatenatedWrite.h:82
void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const double nodeValue)
Add a write with value of type double.
Definition ConcatenatedWrite.h:106
void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const int64_t nodeValue)
Add a write with value of type int64_t.
Definition ConcatenatedWrite.h:98
void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const bool nodeValue)
Add a write with value of type bool.
Definition ConcatenatedWrite.h:114
~CNodeWriteConcatenatorRef()
Destructor.
Definition ConcatenatedWrite.h:73
CNodeWriteConcatenator * get() const
Returns a pointer tthe object owned by *this or nullptr if no object is owned.
Definition ConcatenatedWrite.h:145
void _Add(const GENICAM_NAMESPACE::gcstring &nodeName, const char *nodeValue)
Add a write with value of type char *.
Definition ConcatenatedWrite.h:90
CNodeWriteConcatenator * Release()
Release owenership of the write concatenator object.
Definition ConcatenatedWrite.h:130
CNodeWriteConcatenatorRef()
Constructor.
Definition ConcatenatedWrite.h:65
A string class which is a clone of std::string.
Definition GCString.h:51
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition GCException.h:252