gatb.core-API-0.0.0
Data Class Reference

Definition of a data chunk. More...

#include <Data.hpp>

Inheritance diagram for Data:
Inheritance graph

Classes

struct  ConvertASCII
 

Public Types

typedef std::pair< char, char > ConvertChar
 

Public Member Functions

 Data (Encoding_e encode=BINARY)
 
 Data (char *buffer)
 
 Data (size_t len, Encoding_e encode=BINARY)
 
size_t getBufferLength () const
 
Dataoperator= (const Data &d)
 
void setRef (Data *ref, size_t offset, size_t length)
 
void setRef (char *buffer, size_t length)
 
Encoding_e getEncoding () const
 
void setEncoding (Encoding_e encoding)
 
- Public Member Functions inherited from Vector< char >
 Vector ()
 
 Vector (size_t aSize)
 
Vectoroperator= (const Vector &vect)
 
 ~Vector ()
 
char * getBuffer () const
 
size_t size () const
 
char & operator[] (size_t idx)
 
void resize (size_t aSize)
 
void setSize (size_t size)
 
void setRef (Vector *ref, size_t offset, size_t length)
 
void setRef (char *buffer, size_t length)
 
void set (char *buffer, size_t length)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Static Public Member Functions

static void convert (Data &in, Data &out)
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

Definition of a data chunk.

A data is defined by:

  • an encoding format
  • a buffer holding the actual data
  • the size of the data

It is implemented as a subclass of the Vector class, which allows to define Data as a sub part of a referred Data instance.

For instance, Data is used for storing nucleotides sequences inside the Sequence structure.

Note
In contrast to Vector, the size() represents the number of data elements, not the number of bytes (see Data::getBufferLength() for length in bytes).

Member Typedef Documentation

typedef std::pair<char,char> ConvertChar

Shortcut.

  • first : the nucleotide value (A=0, C=1, T=2, G=3)
  • second : 0 if valid, 1 if invalid (in case of N character for instance)

Member Enumeration Documentation

enum Encoding_e

Define how data is encoded.

Enumerator
ASCII 

data encoded as ASCII codes (so one byte per data unit)

INTEGER 

one byte per data as integer value (for instance: A=0, C=1, T=2, G=3)

BINARY 

4 nucleotides compressed in one byte

Constructor & Destructor Documentation

Data ( Encoding_e  encode = BINARY)
inline

Default constructor.

Data ( char *  buffer)
inline

Default constructor.

Data ( size_t  len,
Encoding_e  encode = BINARY 
)
inline

Constructor.

Member Function Documentation

static void convert ( Data in,
Data out 
)
inlinestatic

Conversion from one encoding scheme to another. TO BE IMPROVED (support only one kind of conversion, from binary to integer)

Parameters
[in]in: input data
[in]out: output data
size_t getBufferLength ( ) const
inline

Number of bytes required for representing the data

Returns
size in bytes
Encoding_e getEncoding ( ) const
inline

Get the encoding scheme of the data.

Returns
format of the data.
Data& operator= ( const Data d)
inline

Affectation operator.

Parameters
[in]d: object to be copied.
Returns
the instance
void setEncoding ( Encoding_e  encoding)
inline

Set the encoding scheme of the data.

Parameters
[in]encoding: encoding scheme to be used.
void setRef ( Data ref,
size_t  offset,
size_t  length 
)
inline

Set the content of this data as a referenced of another Data object.

Parameters
[in]ref: referred data
[in]offset: position to be used in the referred data
[in]length: length of the data
void setRef ( char *  buffer,
size_t  length 
)
inline

Set the current data as a part of a referenced another data.

Parameters
[in]buffer: pointer to the buffer to be referred
[in]length: size of the data

The documentation for this class was generated from the following file: