libQtCassandra 0.3.2

QtCassandra::QCassandraColumnDefinition Class Reference

Hold a Cassandra column definition. More...

#include <QCassandraColumnDefinition.h>

Inheritance diagram for QtCassandra::QCassandraColumnDefinition:
Collaboration diagram for QtCassandra::QCassandraColumnDefinition:

List of all members.

Public Types

enum  index_type_t { INDEX_TYPE_UNKNOWN = -2, INDEX_TYPE_UNDEFINED = -1, INDEX_TYPE_KEYS = 0 }
 

Define the type of index.

More...

Public Member Functions

virtual ~QCassandraColumnDefinition ()
 Clean up the QCassandraColumnDefinition object.
QString columnName () const
 Retrieve the name of the column.
QString indexName () const
 Retrieve the current name of this column index.
index_type_t indexType () const
 Retrieve the type of index.
void setIndexName (const QString &name)
 Set the name of the index table.
void setIndexType (index_type_t index_type)
 Set the type of index used on this column.
void setValidationClass (const QString &name)
 Set the validation class of this column.
void unsetIndexName ()
 Unset the index name.
void unsetIndexType ()
 Remove the index type definition.
QString validationClass () const
 Retrieve the validation class.

Private Member Functions

 QCassandraColumnDefinition (QCassandraTable *table, const QString &name)
 Initialize a QCassandraColumnDefinition object.
void parseColumnDefinition (const void *data)
 This is an internal function used to parse a ColumnDef structure.
void prepareColumnDefinition (void *data) const
 Prepare a column definition.

Private Attributes

std::auto_ptr
< QCassandraColumnDefinitionPrivate
f_private
 Pointer to the private data of the column definition.
QCassandraTablef_table
 Pointer back to the table that created this column definition.

Friends

class QCassandraColumnDefinitionPrivate
class QCassandraTable

Detailed Description

This class is used to read and create column definitions to use with the Cassandra database system.

Definition at line 53 of file QCassandraColumnDefinition.h.


Member Enumeration Documentation

This enumeration defines the type of index used by Cassandra.

At this time only KEYS is defined as an index type. The other two values are used when the type cannot be determined or is defined by not known (i.e. it's not KEYS.)

Enumerator:
INDEX_TYPE_UNKNOWN 

When an index type is defined but the value is not recognized by the libQtCassandra, then this value is used instead.

INDEX_TYPE_UNDEFINED 

When an index type is not defined (__isset is false) then this value is returned.

INDEX_TYPE_KEYS 

The index type is KEYS.

Definition at line 56 of file QCassandraColumnDefinition.h.


Constructor & Destructor Documentation

QtCassandra::QCassandraColumnDefinition::~QCassandraColumnDefinition ( ) [virtual]

This function ensures that all resources allocated by the QCassandraColumnDefinition are released.

Definition at line 134 of file QCassandraColumnDefinition.cpp.

QtCassandra::QCassandraColumnDefinition::QCassandraColumnDefinition ( QCassandraTable table,
const QString &  column_name 
) [private]

This function initializes a QCassandraColumnDefinition object.

All the parameters are set to the defaults as defined in the Cassandra definition of the ColumnDef message. You can use the different functions of this class to change the default values.

Parameters:
[in]tableThe table this column is part of.
[in]column_nameThe name of the column.

Definition at line 121 of file QCassandraColumnDefinition.cpp.

References f_private.


Member Function Documentation

QString QtCassandra::QCassandraColumnDefinition::columnName ( ) const

This function returns the name of the column as specified in the constructor.

The name cannot be changed.

Returns:
A string with the column name.

Definition at line 147 of file QCassandraColumnDefinition.cpp.

References f_private.

QString QtCassandra::QCassandraColumnDefinition::indexName ( ) const

This function returns the name of this column index.

When the name is not set the function returns an empty string.

Returns:
The name of the index.

Definition at line 267 of file QCassandraColumnDefinition.cpp.

References f_private.

QCassandraColumnDefinition::index_type_t QtCassandra::QCassandraColumnDefinition::indexType ( ) const

This function returns the current type of index or INDEX_TYPE_UNDEFINED if the index is not currently defined.

If the index type is defined but not known by the QtCassandra library, then INDEX_TYPE_UNKNOWN is returned.

Returns:
The index type or UNDEFINED.

Definition at line 224 of file QCassandraColumnDefinition.cpp.

References f_private, INDEX_TYPE_KEYS, INDEX_TYPE_UNDEFINED, and INDEX_TYPE_UNKNOWN.

void QtCassandra::QCassandraColumnDefinition::parseColumnDefinition ( const void *  data) [private]

This function is called internally to parse a ColumnDef object.

Parameters:
[in]dataThe pointer to the ColumnDef object.

Definition at line 281 of file QCassandraColumnDefinition.cpp.

References f_private.

void QtCassandra::QCassandraColumnDefinition::prepareColumnDefinition ( void *  data) const [private]

This function copies the private ColumnDef in the specified data parameter.

Parameters:
[in]dataThe destination buffer for the column definition.

Definition at line 318 of file QCassandraColumnDefinition.cpp.

References f_private.

void QtCassandra::QCassandraColumnDefinition::setIndexName ( const QString &  name)

Define the name that the system gives the index table.

Parameters:
[in]nameThe index table name.

Definition at line 245 of file QCassandraColumnDefinition.cpp.

References f_private.

void QtCassandra::QCassandraColumnDefinition::setIndexType ( index_type_t  index_type)

Cassandra offers the ability to build an index over a column. This parameter defines the type of that index.

The currently valid values are:

  • INDEX_TYPE_KEYS -- create an index with the value as a key
Exceptions:
runtime_errorIf the index_type value does not correspond to one of the valid types as defined in the QCassandraColumnDefinition, then this exception is raised.
Parameters:
[in]index_typeThe type of index.

Definition at line 190 of file QCassandraColumnDefinition.cpp.

References f_private, and INDEX_TYPE_KEYS.

void QtCassandra::QCassandraColumnDefinition::setValidationClass ( const QString &  name)

Note that the validation class is a mandatory parameter although it can be set to "" to get the default class.

Parameters:
[in]nameThe name of the new validation class to use with this column.

Definition at line 159 of file QCassandraColumnDefinition.cpp.

References f_private.

void QtCassandra::QCassandraColumnDefinition::unsetIndexName ( )

This function marks the index name as not set.

Definition at line 254 of file QCassandraColumnDefinition.cpp.

References f_private.

void QtCassandra::QCassandraColumnDefinition::unsetIndexType ( )

The index type parameter is optional and can be cleared. This does not mean that the index is removed from the column, just that the information is not sent over the network. (TBD)

Definition at line 209 of file QCassandraColumnDefinition.cpp.

References f_private.

QString QtCassandra::QCassandraColumnDefinition::validationClass ( ) const

This function returns the name of the validation class of this column.

Returns:
The validation class name.

Definition at line 170 of file QCassandraColumnDefinition.cpp.

References f_private.


Friends And Related Function Documentation

friend class QCassandraColumnDefinitionPrivate [friend]

Definition at line 84 of file QCassandraColumnDefinition.h.

friend class QCassandraTable [friend]

Definition at line 83 of file QCassandraColumnDefinition.h.


Member Data Documentation

A pointer back to the table that created this column definition.

This is a bare pointer since a table has a shared pointer to this column definition (i.e. when the table goes, the column definition is gone.)

Definition at line 90 of file QCassandraColumnDefinition.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This document is part of the libQtCassandra Project.

Copyright by Made to Order Software Corp.