class DfcColumn : public DfcColumnInterface | | addImplementation (int tableId, int columnId) |
| | clone (void) |
| | deselect (void) |
| | DfcColumn ( const DfcColumnInterface::TYPE type, const RWString &newName, int numRows, DFC_BOOL regularlySampled ) |
| | DfcColumn ( const DfcColumnInterface::TYPE type, const RWString &name, const DFC_EXPRESSION &expr, int numRows, DFC_BOOL onTheFly = DFC_TRUE ) |
| | DfcColumn ( DfcColumnInterface *other ) |
| | DfcColumn ( const DfcColumn &other ) |
| | DfcColumn (void) |
| | getAsChar (int whichElement = 0) |
| | getAsCoordSys (int whichElement = 0) |
| | getAsDouble (int whichElement = 0) |
| | getAsDouble ( const DfcVector<int> &position ) |
| | getAsEnumerated (int whichElement = 0) |
| | getAsFloat (int whichElement = 0) |
| | getAsFrameRef (int whichElement = 0) |
| | getAsInt (int whichElement = 0) |
| | getAsLong ( const DfcVector<int> &position ) |
| | getAsLong (int whichElement = 0) |
| | getAsShort (int whichElement = 0) |
| | getAsString (int whichElement = 0) |
| | getAsTableRef (int whichElement = 0) |
| | getAsTarget (int whichElement = 0) |
| | getAsTime (int whichElement = 0) |
| | getAsUchar (int whichElement = 0) |
| | getDimensions (void) |
| | getKeywords (void) |
| | getName (void) |
| | getNullValueAsChar (void) |
| | getNullValueAsCoordSys (void) |
| | getNullValueAsDouble (void) |
| | getNullValueAsEnumerated (void) |
| | getNullValueAsFrameRef (void) |
| | getNullValueAsString (void) |
| | getNullValueAsTableRef (void) |
| | getNullValueAsTarget (void) |
| | getNullValueAsTime (void) |
| | getNumPoints (void) |
| | getNumRows (void) |
| | getSafeInterface (void) |
| | getType (void) |
| | isNullValueSet (void) |
| | isSelected (void) |
| | openForRead (void) |
| | openForUpdate (void) |
| | operator!= (double value) |
| | operator!= (const DfcCoordSysInterface &value) |
| | operator!= (DfcTableRef &value) |
| | operator!= (const DfcTargetInterface &value) |
| | operator!= (const DfcTimeInterface &value) |
| | operator!= (const DfcEnumeratedInterface &value) |
| | operator!= (DfcFrameRef &value) |
| | operator!= (const DfcColumn &other) |
| | operator!= (char value) |
| | operator!= (const RWString &value) |
| | operator< (const DfcCoordSysInterface &value) |
| | operator< (const RWString &value) |
| | operator< (const DfcEnumeratedInterface &value) |
| | operator< (const DfcTimeInterface &value) |
| | operator< (DfcFrameRef &value) |
| | operator< (const DfcTargetInterface &value) |
| | operator< (DfcTableRef &value) |
| | operator< (double value) |
| | operator< (char value) |
| | operator<= (const DfcTimeInterface &value) |
| | operator<= (DfcFrameRef &value) |
| | operator<= (const DfcCoordSysInterface &value) |
| | operator<= (double value) |
| | operator<= (const DfcEnumeratedInterface &value) |
| | operator<= (const DfcTargetInterface &value) |
| | operator<= (char value) |
| | operator<= (DfcTableRef &value) |
| | operator<= (const RWString &value) |
| | operator= (const DfcColumnInterface &other) |
| | operator== (const DfcTargetInterface &value) |
| | operator== (const RWString &value) |
| | operator== (const DfcEnumeratedInterface &value) |
| | operator== (DfcFrameRef &value) |
| | operator== (DfcTableRef &value) |
| | operator== (char value) |
| | operator== (const DfcTimeInterface &value) |
| | operator== (const DfcCoordSysInterface &value) |
| | operator== (double value) |
| | operator> (DfcTableRef &value) |
| | operator> (const DfcTargetInterface &value) |
| | operator> (double value) |
| | operator> (const RWString &value) |
| | operator> (const DfcTimeInterface &value) |
| | operator> (const DfcEnumeratedInterface &value) |
| | operator> (const DfcCoordSysInterface &value) |
| | operator> (char value) |
| | operator> (DfcFrameRef &value) |
| | operator>= (char value) |
| | operator>= (const DfcTimeInterface &value) |
| | operator>= (const RWString &value) |
| | operator>= (DfcFrameRef &value) |
| | operator>= (const DfcCoordSysInterface &value) |
| | operator>= (DfcTableRef &value) |
| | operator>= (double value) |
| | operator>= (const DfcTargetInterface &value) |
| | operator>= (const DfcEnumeratedInterface &value) |
| | proxyIsDead (void) |
| | save (void) |
| | saveAsMidas (int fileId) |
| | select (void) |
| | set ( const DfcVector<int> &position, long newVal ) |
| | set (long newValue, int whichElement = 0) |
| | set ( int whichPosition, long newVal ) |
| | set (short newValue, int whichElement = 0) |
| | set (float newValue, int whichElement = 0) |
| | set (double newValue, int whichElement = 0) |
| | set ( const DfcVector<int> &position, double newVal ) |
| | set (unsigned char newValue, int whichElement = 0) |
| | set ( int whichPosition, double newVal ) |
| | set (int newValue, int whichElement = 0) |
| | setAsChar (char newValue, int whichElement = 0) |
| | setAsCoordSys (const DfcCoordSysInterface &newValue, int whichElement = 0) |
| | setAsEnumerated (const DfcEnumeratedInterface &newValue, int whichElement = 0) |
| | setAsFrameRef (DfcFrameRef &newValue, int whichElement = 0) |
| | setAsString (const RWString &newValue, int whichElement = 0) |
| | setAsTableRef (DfcTableRef &newValue, int whichElement = 0) |
| | setAsTarget (const DfcTargetInterface &newValue, int whichElement = 0) |
| | setAsTime (const DfcTimeInterface &newValue, int whichElement = 0) |
| | setName ( const RWString &newName ) |
| | setNullValueAsChar (char newValue) |
| | setNullValueAsCoordSys (const DfcCoordSysInterface &newValue) |
| | setNullValueAsDouble ( double newValue ) |
| | setNullValueAsEnumerated (const DfcEnumeratedInterface &newValue) |
| | setNullValueAsFrameRef (DfcFrameRef &newValue) |
| | setNullValueAsString (const RWString &newValue) |
| | setNullValueAsTableRef (DfcTableRef &newValue) |
| | setNullValueAsTarget (const DfcTargetInterface &newValue) |
| | setNullValueAsTime (const DfcTimeInterface &newValue) |
| | unsetNullValue (void) |
| | ~DfcColumn () Dtor. Free memory |
| | Purpose Default constructor |
| | Purpose Tells the column to save itself |
| | The real object that this proxy referes to |
| | realOne Purpose Informs this object that its proxy object has been deleted |
DESCRIPTION
A Column contains an ordered sequence of data. The data in a single Column should all be of a single type.
DfcColumn is actually a proxy class in order to make the complexity of the implementation details less obvious to the user.
CAUTIONS
EXAMPLES
DfcColumn mycol = myTable.getColumn(2);
try
{
for (int loop = 0; loop < mycol.getNumRows(); loop++)
{
cout << myCol.DELETEME(loop) << endl;
}
}
catch(DfcTypeExc e)
{
cerr << "Column does not hold scalar values\n";
}
{
myTable.select(myTable.getColumn("observer") == "bob");
}
catch (DfcTypeExc e)
{
cerr << "Column doesn't contain string data\n";
}
try
{
for (int loop = 0; loop < myCol.getNumRows(); loop++)
{
if (myTable.isRowSelected(loop))
{
cout << myCol.DELETEME(loop) << endl;
}
}
}
catch(DfcTypeExc e)
{
cerr << "Column does not hold scalar values\n";
}
try
{
DfcCoordSysInterfaceZPA coordObject = myColumn.getAsCoordSys();
DfcCoordSysInterfaceTAN tanProjection = myColumn.getAsCoordSys();
}
catch(DfcTypeExce e)
{
cerr << "Column doesn't contain DfcCoordSysInterface objects\n";
}
DESIGN DECISIONS
DfcColumn contains a fat interface, meaning all the methods of all subclasses are defined whether they are relevant or not. For example we have get() methods for every type of Column that can exist. Of course, this may not be possible in some cases. For example if we have a Column of integers and we invoke getAsCoord(). This method will then throw an exception. This is not an ideal situation as it probably means a LOT of code for checking types or, if a lazy programmer starts to use it, very unsafe code. However, there is no way around it given the requirements - the nature of the objects is not service oriented, it is data oriented.
One nice touch that minimises the concern over types is by allowing conversions where possible between types. For example, if we have a Column that contains Time objects, we can disregard the actual type of Time object by conerting between them and providing the user with whatever type they require. See the examples for more info.
Unfortunately now that we are not dealing with parameterised types explicitly through the use of proxy classes as in the previous design, there is a need to make all the operators explicit in the base class. It can be seen that there are a horrific number of operators now, a set for each type of Column.
Various compromises have been attempted in the course of this rewoek of the design for example, only access methods are provided in this class. To access the rest of the functionality the user must cast down to the appropriate type. Then a proxy class should be reintroduced to make the casting safe. Then we are dealing with template classes again, which was frowned upon. So I would have to create inmstantiations ofthe proxy class - basically just typedef it. Then the user has to use the Info class and the data class again like in the previous design. However, in my mind this seperation doesn't stand up any more when data can be accessed from the base class, it doesn't make sense to have to downcast in the hierarchy in order to be able to access certain methods. So I have completely abandoned this idea and instead opted for the full set of methods in the base class. The implications of this are:
1 - the interface is very large as can be seen. This makes it difficult to find a method that you suspect should be there.
2 - maintenance is therefore harder, even though the methods are very simple, the organisational aspect of the classes is more difficult especially if we ever wish to add in more Column types.
3 - exceptions will have to be generated when the user attempts to use inappropriately typed methods for a class eg if we select all rows where the contents of the row is less than 5, but the contents are actually Frame References. There's either going to be a lot of exception processing (and the current iplementation of exceptions in g++ seems dodgy) or there's going to be a lot of non-OO switch-on-type style code written by the users.
Also it should be noted that for scalar types it is not possible to do transparent overloading because of the following problem: eg
DFC_BOOL operator<(float value) const;
DFC_BOOL operator<(double value) const;
..because if we port to an architecture where 64 bit reals are not supported we would have to make double a 32 bit real ie the same as float which then means the code won't compile as we are trying to declare a method twice.
Therefore all operators involving scalar data will be done to double precision only which may lead to some ugly casting in the user code.
Exceptions Arguments
Exceptions Arguments
Exceptions Arguments
Exceptions Arguments
Returns
Exceptions Arguments
Returns Exceptions
Returns
Returns
Returns
Exceptions Arguments
Returns
Arguments Returns Exceptions
Arguments Returns Exceptions
Arguments Returns Exceptions
Arguments Returns Exceptions
Arguments Returns Exceptions
Arguments Returns Exceptions
DfcColumn( const DfcColumn &other )
Copy constructor. Only perform a shallow copy, in this case it means that the actual data will be shared between the original and the new copy, in effect pretty useless really.
DfcColumn( DfcColumnInterface *other )
Copy constructor. Only perform a shallow copy, in this case it means that the actual data will be shared between the original and the new copy, in effect pretty useless really.
DfcColumn( const DfcColumnInterface::TYPE type, const RWString &newName, int numRows, DFC_BOOL regularlySampled )
Constructor for DfcScalarColumn.
DfcColumn( const DfcColumnInterface::TYPE type, const RWString &name, const DFC_EXPRESSION &expr, int numRows, DFC_BOOL onTheFly = DFC_TRUE )
Constructor. Creates values for the Column entries based upon the provided ewxpression. The values can either be constructed all at once or on the fly. If they are created on the fly and an attempt is made to write to the Column then the column will be made into a regularly sampled column, transparently to the user.
virtual ~DfcColumn()
DfcVector <int> getDimensions(void)
Returns the dimensions of the thing we are dealing with. Implements part of the interface inherited from DfcNumericalInterface
The dimensions of the structure. Rather than raise an exception if something non-numeric is being accessed (ie a KeywordStructure, or a Column of Frames, the Dimensions returned will be zero.
int getNumPoints(void)
void set( int whichPosition, double newVal )
void set( int whichPosition, long newVal )
int getNumRows(void)
Obtain the number of rows in the Column
void setNullValueAsDouble( double newValue )
Sets the representation of the Null Value for this Column. Note that this is particularly dangerous for Columns of scalars. If the internal representation of data is of type int, and we set a null value that is a double, we lose a lot of accuracy and the null value then covers more range than perhaps was desired.
double getNullValueAsDouble(void)
Returns the Columns internal representation for a Null Value. I have decided not to throw an exception if a get() is made on a Null value as this will encourage people to use exceptions for flow control rather than for error handling.
The current representation of the Null value.
void setNullValueAsCoordSys(const DfcCoordSysInterface &newValue)
DfcCoordSys getNullValueAsCoordSys(void)
void setNullValueAsTime(const DfcTimeInterface &newValue)
DfcTime getNullValueAsTime(void)
void setNullValueAsFrameRef(DfcFrameRef &newValue)
DfcFrameRef getNullValueAsFrameRef(void)
void setNullValueAsString(const RWString &newValue)
RWString getNullValueAsString(void)
void setNullValueAsTableRef(DfcTableRef &newValue)
DfcTableRef getNullValueAsTableRef(void)
void setNullValueAsChar(char newValue)
char getNullValueAsChar(void)
void setNullValueAsEnumerated(const DfcEnumeratedInterface &newValue)
DfcEnumerated getNullValueAsEnumerated(void)
void setNullValueAsTarget(const DfcTargetInterface &newValue)
DfcTarget getNullValueAsTarget(void)
void unsetNullValue(void)
Remove any current setting of the null value for this Column
DFC_BOOL isNullValueSet(void)
Indicates whether the null value representation has been set and is being used or not. It may be concievable in some situations that it isn't desirable to waste a possibly valid value on a null representation.
A Boolean stating whether the Null value representation has been set or not.
DFC_BOOL isSelected(void)
Returns the status of the Column, whether it is currently selected or not.
Status of the Column, selected or not.
void select(void)
A Column can be either selected or not. This method tells a Column that it is selected. A Column is not selected by default.
void deselect(void)
A Column can be either Selcted or not. This method informs the Column that it is not selected. A Column is not selected by default.
RWString getName(void)
Accessor for the name of the Column;
Returns a copy of the name of the Column. Actually copies the name rather than returning a reference in order to make sure we don't have any dangling pointers or references later.
void setName( const RWString &newName )
Sets the name for the Column
DfcColumnInterface::TYPE getType(void)
Accessor method for the type of data that is held in the Column.
Returns an indication of the type of data that is held in the Columns.
DfcVector <DFC_BOOL> operator<(double value)
Less than operator for Columns of Type against a single value. The Column will perform the comparison against every single value contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator>(double value)
Greater than operator for Columns of ints against a single int value. The Column will perform the comparison against every single int contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator>=(double value)
Comparison operator for Columns of ints against a single int value. The Column will perform the comparison against every single int contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator<=(double value)
Comparison operator for Columns of ints against a single int value. The Column will perform the comparison against every single int contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator==(double value)
Comparison operator for Columns of ints against a single int value. The Column will perform the comparison against every single int contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator!=(double value)
Comparison operator for Columns of ints against a single int value. The Column will perform the comparison against every single int contained in the Column returning a boolean value for every entry indicating whether the coimparison was true or false.
A vector of booleans. The length of this vector is the same as the Column. Each entry in the vector indicates whether the corresponding entry in the Column passed the comparison or not.
DfcVector <DFC_BOOL> operator<(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator<=(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator>(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator>=(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator==(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator!=(const DfcCoordSysInterface &value)
DfcVector <DFC_BOOL> operator<(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator<=(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator>(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator>=(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator==(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator!=(const DfcTimeInterface &value)
DfcVector <DFC_BOOL> operator<(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator<=(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator>(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator>=(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator==(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator!=(DfcFrameRef &value)
DfcVector <DFC_BOOL> operator<(const RWString &value)
DfcVector <DFC_BOOL> operator<=(const RWString &value)
DfcVector <DFC_BOOL> operator>(const RWString &value)
DfcVector <DFC_BOOL> operator>=(const RWString &value)
DfcVector <DFC_BOOL> operator==(const RWString &value)
DfcVector <DFC_BOOL> operator!=(const RWString &value)
DfcVector <DFC_BOOL> operator<(DfcTableRef &value)
DfcVector <DFC_BOOL> operator<=(DfcTableRef &value)
DfcVector <DFC_BOOL> operator>(DfcTableRef &value)
DfcVector <DFC_BOOL> operator>=(DfcTableRef &value)
DfcVector <DFC_BOOL> operator==(DfcTableRef &value)
DfcVector <DFC_BOOL> operator!=(DfcTableRef &value)
DfcVector <DFC_BOOL> operator<(char value)
DfcVector <DFC_BOOL> operator<=(char value)
DfcVector <DFC_BOOL> operator>(char value)
DfcVector <DFC_BOOL> operator>=(char value)
DfcVector <DFC_BOOL> operator==(char value)
DfcVector <DFC_BOOL> operator!=(char value)
DFC_BOOL operator!=(const DfcColumn &other)
DfcVector <DFC_BOOL> operator<(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator<=(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator>(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator>=(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator==(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator!=(const DfcEnumeratedInterface &value)
DfcVector <DFC_BOOL> operator<(const DfcTargetInterface &value)
DfcVector <DFC_BOOL> operator<=(const DfcTargetInterface &value)
DfcVector <DFC_BOOL> operator>(const DfcTargetInterface &value)
DfcVector <DFC_BOOL> operator>=(const DfcTargetInterface &value)