template to mimic a db column.
More...
#include <carma/dbms/Column.h>
Inherits vector< T >.
|
std::string | name_ |
|
std::vector< unsigned > | nullIndices_ |
|
T | nullValue_ |
|
template<typename T>
class carma::dbms::Column< T >
template to mimic a db column.
Definition at line 31 of file Column.h.
constuctor
- Parameters
-
Definition at line 39 of file Column.h.
destructor, derived classes may want to override
Definition at line 46 of file Column.h.
get distinct values of a column
- Parameters
-
the | resulting column name |
includeNull | include a null entry if the column has at least one null value |
- Returns
- a column containing only distinct values
Definition at line 385 of file Column.h.
get the column name
- Returns
- the column name
Definition at line 53 of file Column.h.
get the indices for NULL values.
The values (data indices) in the returned vector are garaunteed to be in ascending order
- Returns
- vector containing indices of NULL values in the column
Definition at line 66 of file Column.h.
get the NULL data value
- Returns
- the value used for the NULL value
Definition at line 93 of file Column.h.
return true if the column contains NULL values
- Returns
- true if the column contains NULL values
Definition at line 59 of file Column.h.
find the first occurence of a specified value
- Parameters
-
- Returns
- the index of the first occurence of the non-null specified value or -1 if the value is not found FIXME probably need a sorting algorithm to improve performance for large columns
Definition at line 223 of file Column.h.
is the specified element null?
- Parameters
-
index | the index of the element |
- Returns
- true if the element is null
- Exceptions
-
out | of range if the specified index equals or exceeds the column size |
Definition at line 127 of file Column.h.
get the maximum non-null column values
- Returns
- the max non-null value
Definition at line 177 of file Column.h.
get the average of the non-null column values
- Returns
- the mean value of the non-nulls
Definition at line 168 of file Column.h.
get the minumum non-null column value
- Returns
- the min non-null value
Definition at line 199 of file Column.h.
add a NULL element to the end of the column
Definition at line 71 of file Column.h.
Set the value of NULL values.
All existing NULL elements will be changed to this value
- Parameters
-
Definition at line 81 of file Column.h.
sum all non-null column values FIXME probably need a way to guard against doing this for strings
- Returns
- the summed value
Definition at line 153 of file Column.h.
return a string representation of the column
- Returns
- string repreentation of the column
Definition at line 99 of file Column.h.
template<typename T , typename U >
Map the values in keyColumn
to the values in valueColumn
. This function will throw an carma::util::IllegalArgumentException if, either (or both) columns have at least one null value or if the columns have a different number of elements. Furthermore, keyColumn
must have all unique elements since these elements will be the keys of the returned map. If the columns pass these tests, the returned map will have the elments of keyColumn
as keys mapped to the elements of valueColumn
. The mapping is done by index.
- Parameters
-
keyColumn | the column whose elements will be the keys of the mapping |
otherColumn | the column whose elements will be the values of the mapping |
- Returns
- the mapping
- Exceptions
-
Definition at line 297 of file Column.h.
The documentation for this class was generated from the following file: