jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Public Member Functions | Private Attributes | Friends | List of all members
jubatus::core::storage::detail::abstract_column Class Reference

#include <abstract_column.hpp>

Collaboration diagram for jubatus::core::storage::detail::abstract_column:
Collaboration graph

Public Member Functions

 abstract_column ()
 
 abstract_column (const column_type &type)
 
void clear ()
 
void dump (std::ostream &os, uint64_t target) const
 
abstract_column_baseget ()
 
const abstract_column_baseget () const
 
template<typename T >
bool insert (uint64_t index, const T &value)
 
template<class Buffer >
void msgpack_pack (msgpack::packer< Buffer > &packer) const
 
void msgpack_unpack (msgpack::object o)
 
void pack_with_index (uint64_t index, framework::packer &pk) const
 
template<typename T >
void push_back (const T &value)
 
bool remove (uint64_t index)
 
void swap (abstract_column &x)
 
column_type type () const
 
template<typename T >
bool update (uint64_t index, const T &value)
 

Private Attributes

jubatus::util::lang::shared_ptr< abstract_column_basebase_
 

Friends

void swap (abstract_column &l, abstract_column &r)
 

Detailed Description

Definition at line 388 of file abstract_column.hpp.

Constructor & Destructor Documentation

jubatus::core::storage::detail::abstract_column::abstract_column ( )
inline

Definition at line 390 of file abstract_column.hpp.

Referenced by msgpack_unpack().

390  {
391  }

Here is the caller graph for this function:

jubatus::core::storage::detail::abstract_column::abstract_column ( const column_type type)
inlineexplicit

Definition at line 393 of file abstract_column.hpp.

References base_, jubatus::core::storage::column_type::bit_vector_type, jubatus::core::storage::column_type::double_type, jubatus::core::storage::column_type::float_type, jubatus::core::storage::column_type::int16_type, jubatus::core::storage::column_type::int32_type, jubatus::core::storage::column_type::int64_type, jubatus::core::storage::column_type::int8_type, jubatus::core::storage::column_type::is(), JUBATUS_ASSERT_UNREACHABLE, jubatus::core::storage::column_type::string_type, jubatus::core::storage::column_type::uint16_type, jubatus::core::storage::column_type::uint32_type, jubatus::core::storage::column_type::uint64_type, and jubatus::core::storage::column_type::uint8_type.

393  {
395  base_.reset(new uint8_column(type));
396  } else if (type.is(column_type::uint16_type)) {
397  base_.reset(new uint16_column(type));
398  } else if (type.is(column_type::uint32_type)) {
399  base_.reset(new uint32_column(type));
400  } else if (type.is(column_type::uint64_type)) {
401  base_.reset(new uint64_column(type));
402  } else if (type.is(column_type::int8_type)) {
403  base_.reset(new int8_column(type));
404  } else if (type.is(column_type::int16_type)) {
405  base_.reset(new int16_column(type));
406  } else if (type.is(column_type::int32_type)) {
407  base_.reset(new int32_column(type));
408  } else if (type.is(column_type::int64_type)) {
409  base_.reset(new int64_column(type));
410  } else if (type.is(column_type::float_type)) {
411  base_.reset(new float_column(type));
412  } else if (type.is(column_type::double_type)) {
413  base_.reset(new double_column(type));
414  } else if (type.is(column_type::string_type)) {
415  base_.reset(new string_column(type));
416  } else if (type.is(column_type::bit_vector_type)) {
417  base_.reset(new bit_vector_column(type));
418  } else {
420  }
421  }
typed_column< std::string > string_column
#define JUBATUS_ASSERT_UNREACHABLE()
Definition: assert.hpp:59
typed_column< uint16_t > uint16_column
typed_column< uint32_t > uint32_column
typed_column< float > float_column
typed_column< int32_t > int32_column
bool is(const type_name &type) const
Definition: column_type.hpp:66
typed_column< int64_t > int64_column
typed_column< uint8_t > uint8_column
typed_column< uint64_t > uint64_column
jubatus::util::lang::shared_ptr< abstract_column_base > base_
typed_column< double > double_column
typed_column< int16_t > int16_column
typed_column< bit_vector > bit_vector_column
typed_column< int8_t > int8_column

Here is the call graph for this function:

Member Function Documentation

void jubatus::core::storage::detail::abstract_column::clear ( )
inline

Definition at line 448 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

448  {
449  JUBATUS_ASSERT(base_ != NULL);
450  base_->clear();
451  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
void jubatus::core::storage::detail::abstract_column::dump ( std::ostream &  os,
uint64_t  target 
) const
inline

Definition at line 464 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

464  {
465  JUBATUS_ASSERT(base_ != NULL);
466  base_->dump(os, target);
467  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
abstract_column_base* jubatus::core::storage::detail::abstract_column::get ( )
inline

Definition at line 457 of file abstract_column.hpp.

References base_.

457  {
458  return base_.get();
459  }
jubatus::util::lang::shared_ptr< abstract_column_base > base_
const abstract_column_base* jubatus::core::storage::detail::abstract_column::get ( ) const
inline

Definition at line 460 of file abstract_column.hpp.

References base_.

460  {
461  return base_.get();
462  }
jubatus::util::lang::shared_ptr< abstract_column_base > base_
template<typename T >
bool jubatus::core::storage::detail::abstract_column::insert ( uint64_t  index,
const T &  value 
)
inline

Definition at line 435 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

435  {
436  JUBATUS_ASSERT(base_ != NULL);
437  return base_->insert(index, value);
438  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
template<class Buffer >
void jubatus::core::storage::detail::abstract_column::msgpack_pack ( msgpack::packer< Buffer > &  packer) const
inline

Definition at line 477 of file abstract_column.hpp.

References base_, jubatus::core::storage::column_type::bit_vector_type, jubatus::core::storage::column_type::double_type, jubatus::core::storage::column_type::float_type, jubatus::core::storage::column_type::int16_type, jubatus::core::storage::column_type::int32_type, jubatus::core::storage::column_type::int64_type, jubatus::core::storage::column_type::int8_type, jubatus::core::storage::column_type::is(), JUBATUS_ASSERT_UNREACHABLE, jubatus::core::storage::column_type::string_type, type(), jubatus::core::storage::column_type::uint16_type, jubatus::core::storage::column_type::uint32_type, jubatus::core::storage::column_type::uint64_type, and jubatus::core::storage::column_type::uint8_type.

477  {
478  column_type type = base_->type();
479 
480  packer.pack_array(2);
481  packer.pack(type);
482 
483  if (type.is(column_type::uint8_type)) {
484  static_cast<const uint8_column&>(*base_).pack_array(packer);
485  } else if (type.is(column_type::uint16_type)) {
486  static_cast<const uint16_column&>(*base_).pack_array(packer);
487  } else if (type.is(column_type::uint32_type)) {
488  static_cast<const uint32_column&>(*base_).pack_array(packer);
489  } else if (type.is(column_type::uint64_type)) {
490  static_cast<const uint64_column&>(*base_).pack_array(packer);
491  } else if (type.is(column_type::int8_type)) {
492  static_cast<const int8_column&>(*base_).pack_array(packer);
493  } else if (type.is(column_type::int16_type)) {
494  static_cast<const int16_column&>(*base_).pack_array(packer);
495  } else if (type.is(column_type::int32_type)) {
496  static_cast<const int32_column&>(*base_).pack_array(packer);
497  } else if (type.is(column_type::int64_type)) {
498  static_cast<const int64_column&>(*base_).pack_array(packer);
499  } else if (type.is(column_type::float_type)) {
500  static_cast<const float_column&>(*base_).pack_array(packer);
501  } else if (type.is(column_type::double_type)) {
502  static_cast<const double_column&>(*base_).pack_array(packer);
503  } else if (type.is(column_type::string_type)) {
504  static_cast<const string_column&>(*base_).pack_array(packer);
505  } else if (type.is(column_type::bit_vector_type)) {
506  static_cast<const bit_vector_column&>(*base_).pack_array(packer);
507  } else {
509  }
510  }
typed_column< std::string > string_column
#define JUBATUS_ASSERT_UNREACHABLE()
Definition: assert.hpp:59
typed_column< uint16_t > uint16_column
typed_column< uint32_t > uint32_column
typed_column< float > float_column
typed_column< int32_t > int32_column
typed_column< int64_t > int64_column
void pack_array(msgpack::packer< Buffer > &packer) const
typed_column< uint8_t > uint8_column
typed_column< uint64_t > uint64_column
jubatus::util::lang::shared_ptr< abstract_column_base > base_
typed_column< double > double_column
typed_column< int16_t > int16_column
typed_column< bit_vector > bit_vector_column
typed_column< int8_t > int8_column

Here is the call graph for this function:

void jubatus::core::storage::detail::abstract_column::msgpack_unpack ( msgpack::object  o)
inline

Definition at line 511 of file abstract_column.hpp.

References abstract_column(), base_, jubatus::core::storage::column_type::bit_vector_type, jubatus::core::storage::column_type::double_type, jubatus::core::storage::column_type::float_type, jubatus::core::storage::column_type::int16_type, jubatus::core::storage::column_type::int32_type, jubatus::core::storage::column_type::int64_type, jubatus::core::storage::column_type::int8_type, jubatus::core::storage::column_type::is(), JUBATUS_ASSERT_UNREACHABLE, objs, jubatus::core::storage::column_type::string_type, swap(), type(), jubatus::core::storage::column_type::uint16_type, jubatus::core::storage::column_type::uint32_type, jubatus::core::storage::column_type::uint64_type, and jubatus::core::storage::column_type::uint8_type.

511  {
512  if (o.type != msgpack::type::ARRAY || o.via.array.size != 2) {
513  throw msgpack::type_error();
514  }
515  msgpack::object* objs = o.via.array.ptr;
516 
517  column_type type;
518  objs[0].convert(&type);
519 
520  abstract_column tmp;
521  if (!base_) {
522  abstract_column(type).swap(tmp); // NOLINT
523  } else if (base_->type() == type) {
524  this->swap(tmp);
525  } else {
526  throw type_unmatch_exception(
527  "column: invalid type in serialize(): "
528  "expected: " +
529  jubatus::util::lang::lexical_cast<std::string>(base_->type()) +
530  ", actual: " +
531  jubatus::util::lang::lexical_cast<std::string>(type));
532  }
533 
534  if (type.is(column_type::uint8_type)) {
535  static_cast<uint8_column&>(*tmp.base_).unpack_array(objs[1]);
536  } else if (type.is(column_type::uint16_type)) {
537  static_cast<uint16_column&>(*tmp.base_).unpack_array(objs[1]);
538  } else if (type.is(column_type::uint32_type)) {
539  static_cast<uint32_column&>(*tmp.base_).unpack_array(objs[1]);
540  } else if (type.is(column_type::uint64_type)) {
541  static_cast<uint64_column&>(*tmp.base_).unpack_array(objs[1]);
542  } else if (type.is(column_type::int8_type)) {
543  static_cast<int8_column&>(*tmp.base_).unpack_array(objs[1]);
544  } else if (type.is(column_type::int16_type)) {
545  static_cast<int16_column&>(*tmp.base_).unpack_array(objs[1]);
546  } else if (type.is(column_type::int32_type)) {
547  static_cast<int32_column&>(*tmp.base_).unpack_array(objs[1]);
548  } else if (type.is(column_type::int64_type)) {
549  static_cast<int64_column&>(*tmp.base_).unpack_array(objs[1]);
550  } else if (type.is(column_type::float_type)) {
551  static_cast<float_column&>(*tmp.base_).unpack_array(objs[1]);
552  } else if (type.is(column_type::double_type)) {
553  static_cast<double_column&>(*tmp.base_).unpack_array(objs[1]);
554  } else if (type.is(column_type::string_type)) {
555  static_cast<string_column&>(*tmp.base_).unpack_array(objs[1]);
556  } else if (type.is(column_type::bit_vector_type)) {
557  static_cast<bit_vector_column&>(*tmp.base_).unpack_array(objs[1]);
558  } else {
560  }
561 
562  this->swap(tmp);
563  }
typed_column< std::string > string_column
#define JUBATUS_ASSERT_UNREACHABLE()
Definition: assert.hpp:59
typed_column< uint16_t > uint16_column
typed_column< uint32_t > uint32_column
typed_column< float > float_column
typed_column< int32_t > int32_column
typed_column< int64_t > int64_column
typed_column< uint8_t > uint8_column
typed_column< uint64_t > uint64_column
jubatus::util::lang::shared_ptr< abstract_column_base > base_
typed_column< double > double_column
vector< msgpack::object > objs
typed_column< int16_t > int16_column
typed_column< bit_vector > bit_vector_column
typed_column< int8_t > int8_column

Here is the call graph for this function:

void jubatus::core::storage::detail::abstract_column::pack_with_index ( uint64_t  index,
framework::packer pk 
) const
inline

Definition at line 452 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

453  {
454  JUBATUS_ASSERT(base_ != NULL);
455  base_->pack_with_index(index, pk);
456  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
template<typename T >
void jubatus::core::storage::detail::abstract_column::push_back ( const T &  value)
inline

Definition at line 429 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

429  {
430  JUBATUS_ASSERT(base_ != NULL);
431  base_->push_back(value);
432  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
bool jubatus::core::storage::detail::abstract_column::remove ( uint64_t  index)
inline

Definition at line 444 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

444  {
445  JUBATUS_ASSERT(base_ != NULL);
446  return base_->remove(index);
447  };
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_
void jubatus::core::storage::detail::abstract_column::swap ( abstract_column x)
inline

Definition at line 469 of file abstract_column.hpp.

References base_.

Referenced by msgpack_unpack().

469  {
470  base_.swap(x.base_);
471  }
jubatus::util::lang::shared_ptr< abstract_column_base > base_

Here is the caller graph for this function:

column_type jubatus::core::storage::detail::abstract_column::type ( ) const
inline

Definition at line 423 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

Referenced by msgpack_pack(), and msgpack_unpack().

423  {
424  JUBATUS_ASSERT(base_ != NULL);
425  return base_->type();
426  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_

Here is the caller graph for this function:

template<typename T >
bool jubatus::core::storage::detail::abstract_column::update ( uint64_t  index,
const T &  value 
)
inline

Definition at line 440 of file abstract_column.hpp.

References base_, and JUBATUS_ASSERT.

440  {
441  JUBATUS_ASSERT(base_ != NULL);
442  return base_->update(index, value);
443  }
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
jubatus::util::lang::shared_ptr< abstract_column_base > base_

Friends And Related Function Documentation

void swap ( abstract_column l,
abstract_column r 
)
friend

Definition at line 472 of file abstract_column.hpp.

472  {
473  l.swap(r);
474  }

Member Data Documentation

jubatus::util::lang::shared_ptr<abstract_column_base> jubatus::core::storage::detail::abstract_column::base_
private

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