casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AttValPoiTol.h
Go to the documentation of this file.
1 //# AttValPoiTol.h: template for tolerant and aliased AttributeValues
2 //# Copyright (C) 1996,1997,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_ATTVALPOITOL_H
29 #define TRIALDISPLAY_ATTVALPOITOL_H
30 
31 #include <casa/aips.h>
33 
34 namespace casa { //# NAMESPACE CASA - BEGIN
35 
36 // <summary>
37 // Templated class for aliased, tolerant AttributeValues.
38 // </summary>
39 
40 // <use visibility=local>
41 
42 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tAttribute" demos="">
43 // </reviewed>
44 
45 // <prerequisite>
46 // <li> <linkto class="AttributeValue">AttributeValue</linkto>
47 // <li> <linkto class="AttributeValuePoi">AttributeValuePoi</linkto>
48 // <li> <linkto class="AttributeValueTol">AttributeValueTol</linkto>
49 // </prerequisite>
50 
51 // <etymology>
52 // "AttributeValuePoiTol" is a contraction of "Attribute Value",
53 // "Pointer" and "Tolerance", and stores an Attribute by aliasing
54 // it with a pointer and associating it with some tolerance.
55 // </etymology>
56 
57 // <synopsis>
58 // An AttributeValuePoiTol combines the aliasing (via a pointer)
59 // provided by the <linkto class="AttributeValuePoi">
60 // AttributeValuePoi </linkto> class, and the tolerance provided by
61 // the <linkto class="AttributeValueTol"> AttributeValueTol </linkto>
62 // class. See these classes for examples.
63 // </synopsis>
64 
65 // <motivation>
66 // The motivation for this class is to be able to provide in-built
67 // tolerance and aliasing for AttributeValues.
68 // </motivation>
69 
70 // <todo asof="2000/01/17">
71 // </todo>
72 
73  template <class T> class AttributeValuePoiTol : public AttributeValueTol<T> {
74 
75  public:
76 
77  // Constructor for a pointer to a scalar, and a tolerance.
78  AttributeValuePoiTol(T* value, const T &tolerance, const casacore::Bool strict);
79 
80  // Constructor for a pointer to a <src>casacore::Vector</src>, and a scalar
81  // tolerance.
82  AttributeValuePoiTol(casacore::Vector<T>* value, const T &tolerance,
83  const casacore::Bool strict);
84 
85  // Copy constructor.
87 
88  // Destructor.
89  virtual ~AttributeValuePoiTol();
90 
91  // Assignment operator.
93 
94  // Return a new copy of the AttributeValuePoiTol (virtual constructor).
95  virtual AttributeValueBase *clone() const;
96 
97  // Add <src>other</src> to <src>*this</src>. Needs to over-ride
98  // base class definition because the pointers need to be
99  // dereferenced prior to addition.
100  virtual void operator+=(const AttributeValueBase &other);
101 
102 
103  // Change the value of the AttributeValue.
104  // <group>
105  virtual void setValue(const T& value);
106  virtual void setValue(const casacore::Vector<T>& value);
107  // </group>
108 
109  // Get the DataType of the aliased variable.
110  virtual casacore::DataType getPointerType() const;
111 
112  // Return class name
113  virtual casacore::String className() const {
114  return casacore::String("AttributeValuePoiTol");
115  };
116 
117  private:
118 
119  // Update the variable that is aliased to the AttributeValuePoiTol.
120  void updatePointerValue() const;
121 
122  // Pointer to the aliased variable. Only one is ever active depending
123  // upon how the object was constructed. The memory allocated to these pointers
124  // does not belong to this object.
125  // <group>
128  // </group>
129 
130  // The pointer DataType
131  casacore::DataType itsPointerType;
132 
133  // Cast from Base class
134  const AttributeValuePoiTol<T>& myCast (const AttributeValueBase& other) const;
135 
136  // Default constructor
138 
139 
140  //# Make parent members known.
141  public:
145  };
146 
147 
148 } //# NAMESPACE CASA - END
149 #ifndef AIPS_NO_TEMPLATE_SRC
150 #include <display/Display/AttValPoiTol.tcc>
151 #endif
152 #endif
A 1-D Specialization of the Array class.
const AttributeValuePoiTol< T > & operator=(const AttributeValuePoiTol< T > &other)
Assignment operator.
Templated class for aliased, tolerant AttributeValues.
Definition: AttValPoiTol.h:73
void updatePointerValue() const
Update the variable that is aliased to the AttributeValuePoiTol.
casacore::DataType itsPointerType
The pointer DataType.
Definition: AttValPoiTol.h:131
const AttributeValuePoiTol< T > & myCast(const AttributeValueBase &other) const
Cast from Base class.
virtual void setValue(const T &value)
Change the value of the AttributeValue.
virtual casacore::String className() const
Return class name.
Definition: AttValPoiTol.h:113
virtual AttributeValueBase * clone() const
Return a new copy of the AttributeValuePoiTol (virtual constructor).
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Base class for values of Attributes used in the display classes.
Definition: AttValBase.h:182
Templated class for storing Attributes which have a tolerance.
Definition: AttValTol.h:96
casacore::Vector< T > * itsVectorPointerPtr
Pointer to the aliased variable.
Definition: AttValPoiTol.h:126
virtual void operator+=(const AttributeValueBase &other)
Add other to *this.
virtual casacore::DataType getPointerType() const
Get the DataType of the aliased variable.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
AttributeValuePoiTol()
Default constructor.
virtual ~AttributeValuePoiTol()
Destructor.