DataDirector API
DDD_AttributeByteBuffer.h
1 
2 /*! \file DDD_AttributeString.h
3  \brief The DDD_AttributeString class. String attribute
4  \par Copyright Information
5 
6  Copyright (c) 2012 The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBLITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 
41 #ifndef _DDD_AttributeByteBuffer_h_
42 #define _DDD_AttributeByteBuffer_h_
43 
44 #include "DDD_AttributeBase.h"
45 
46 namespace disti
47 {
48 
49 /** \brief DataDirector attribute class corresponding to a character array datatype.
50  * \ingroup GroupAttributes
51  */
52 class DDD_EXPORT DDD_AttributeByteBuffer : public DDD_AttributeBase
53 {
54 public:
55 
56  /** constructor
57  * \param name The attribute's name
58  * \param initialVal The attribute's initial value
59  * \param length The bytebuffer's initial value's length
60  * \param container The container that will "own" this attribute
61  * \param validConnectionStates Valid connection states for the attribute (INPUT,OUTPUT, IN_OUT); see DDD_AttributeBase::ConnectionState
62  * \param persistent True if it's a persistent attribute
63  * \param revertable If not NULL, it's a pointer to the revertable attribute for this attribute
64  */
65  DDD_AttributeByteBuffer(const std::string &name,char* initialVal,unsigned int length,DDD_AttributeContainer *container, int validConnectionStates,bool persistent,DDD_AttributeBase *revertable);
66 
67  /** destructor */
69 
70  // DDD_AttributeBase methods
71  virtual DataType GetPreferredDataType() const;
72 
73  virtual std::string GetValueString() const;
74  virtual void SetValueString(const std::string &value,bool notify, DDD_AttributeObserver *originator);
75 
76  virtual int GetValueInt(void) const;
77  virtual void SetValueInt(const int value,bool notify, DDD_AttributeObserver *originator);
78 
79  virtual unsigned int GetValueUInt(void) const;
80  virtual void SetValueUInt(const unsigned int value,bool notify, DDD_AttributeObserver *originator);
81 
82  virtual double GetValueDouble(void) const;
83  virtual void SetValueDouble(const double value,bool notify, DDD_AttributeObserver *originator);
84 
85  virtual bool GetValueBool(void) const;
86  virtual void SetValueBool(const bool value,bool notify, DDD_AttributeObserver *originator);
87 
88  virtual void SetValueByteBuffer(const char *buffer, unsigned int length, bool notify, DDD_AttributeObserver *originator);
89  virtual void GetValueByteBuffer(char **buffer, unsigned int &length);
90 
91  static void RemoveNullChars(char* buff, unsigned int length, char replaceWith = ' ');
92 
93 protected:
94  /** Deletes the value buffer and sets it to NULL, sets the lengh to zero */
95  void SafeDeleteValue();
96 
97  /** Safely reallocates the buffer if newLength != _length */
98  void ResizeBuffer(unsigned int newLength);
99 
100 protected:
101  char *_value;
102  unsigned int _length;
103 };
104 
105 
106 } // end namespace disti
107 
108 #endif // _DDD_AttributeByteBuffer_h_
109 
DDD_AttributeContainer. A virtual interface class for containers of attributes.
Definition: DDD_AttributeBase.h:57
A virtual interface class for all DataDirector attribute types.
Definition: DDD_AttributeBase.h:87
DataType
Definition: DDD_AttributeBase.h:104
A virtual interface class for observers of attributes. AttributeObserver-derived objects are able to ...
Definition: DDD_AttributeBase.h:66
Definition: AttributeChangedEmitter.h:46
DataDirector attribute class corresponding to a character array datatype.
Definition: DDD_AttributeByteBuffer.h:52