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::typed_column< T > Class Template Reference

#include <bit_vector_ranking.hpp>

Inheritance diagram for jubatus::core::storage::typed_column< T >:
Inheritance graph
Collaboration diagram for jubatus::core::storage::typed_column< T >:
Collaboration graph

Public Member Functions

void clear ()
 
void dump (std::ostream &os, uint64_t target) const
 
bool insert (uint64_t target, const T &value)
 
bool insert (uint64_t target, const msgpack::object &obj)
 
const T & operator[] (uint64_t index) const
 
T & operator[] (uint64_t index)
 
template<class Buffer >
void pack_array (msgpack::packer< Buffer > &packer) const
 
void pack_with_index (const uint64_t index, framework::packer &pk) const
 
void push_back (const T &value)
 
void push_back (const msgpack::object &obj)
 
bool remove (uint64_t target)
 
uint64_t size () const
 
 typed_column (const column_type &type)
 
void unpack_array (msgpack::object o)
 
bool update (uint64_t index, const T &value)
 
bool update (uint64_t target, const msgpack::object &obj)
 
- Public Member Functions inherited from jubatus::core::storage::detail::abstract_column_base
 abstract_column_base (const column_type &type)
 
 JUBATUS_GEN_FUNCTIONS_ (uint8_t)
 
 JUBATUS_GEN_FUNCTIONS_ (uint16_t)
 
 JUBATUS_GEN_FUNCTIONS_ (uint32_t)
 
 JUBATUS_GEN_FUNCTIONS_ (uint64_t)
 
 JUBATUS_GEN_FUNCTIONS_ (int8_t)
 
 JUBATUS_GEN_FUNCTIONS_ (int16_t)
 
 JUBATUS_GEN_FUNCTIONS_ (int32_t)
 
 JUBATUS_GEN_FUNCTIONS_ (int64_t)
 
 JUBATUS_GEN_FUNCTIONS_ (float)
 
 JUBATUS_GEN_FUNCTIONS_ (double)
 
 JUBATUS_GEN_FUNCTIONS_ (std::string)
 
 JUBATUS_GEN_FUNCTIONS_ (bit_vector)
 
 JUBATUS_GEN_FUNCTIONS_ (msgpack::object)
 
column_type type () const
 
virtual ~abstract_column_base ()
 

Private Attributes

std::vector< T > array_
 

Friends

std::ostream & operator<< (std::ostream &os, const typed_column< T > &it)
 

Detailed Description

template<typename T>
class jubatus::core::storage::typed_column< T >

Definition at line 31 of file bit_vector_ranking.hpp.

Constructor & Destructor Documentation

template<typename T>
jubatus::core::storage::typed_column< T >::typed_column ( const column_type type)
inlineexplicit

Definition at line 105 of file abstract_column.hpp.

106  : detail::abstract_column_base(type) {
107  }

Member Function Documentation

template<typename T>
void jubatus::core::storage::typed_column< T >::clear ( )
inlinevirtual
template<typename T>
void jubatus::core::storage::typed_column< T >::dump ( std::ostream &  os,
uint64_t  target 
) const
inlinevirtual

Implements jubatus::core::storage::detail::abstract_column_base.

Definition at line 197 of file abstract_column.hpp.

197  {
198  os << "[" << target << "] " << (*this)[target] << std::endl;
199  }
template<typename T>
bool jubatus::core::storage::typed_column< T >::insert ( uint64_t  target,
const T &  value 
)
inline

Definition at line 120 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_, and jubatus::core::storage::typed_column< T >::size().

Referenced by jubatus::core::storage::typed_column< T >::insert(), and jubatus::core::storage::typed_column< bit_vector >::insert().

120  {
121  if (size() < target) {
122  return false;
123  }
124  array_.insert(array_.begin() + target, value);
125  return true;
126  }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
bool jubatus::core::storage::typed_column< T >::insert ( uint64_t  target,
const msgpack::object &  obj 
)
inline

Definition at line 127 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::insert().

127  {
128  return typed_column::insert(target, obj.as<T>());
129  }
bool insert(uint64_t target, const T &value)

Here is the call graph for this function:

template<typename T>
const T& jubatus::core::storage::typed_column< T >::operator[] ( uint64_t  index) const
inline

Definition at line 159 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_, and jubatus::core::storage::typed_column< T >::size().

159  {
160  if (size() <= index) {
161  throw length_unmatch_exception(
162  "invalid index [" +
163  jubatus::util::lang::lexical_cast<std::string>(index) +
164  "] for [" +
165  jubatus::util::lang::lexical_cast<std::string>(array_.size()));
166  }
167  return array_[index];
168  }

Here is the call graph for this function:

template<typename T>
T& jubatus::core::storage::typed_column< T >::operator[] ( uint64_t  index)
inline

Definition at line 170 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_, and jubatus::core::storage::typed_column< T >::size().

170  {
171  if (size() <= index) {
172  throw length_unmatch_exception(
173  "invalid index [" +
174  jubatus::util::lang::lexical_cast<std::string>(index) +
175  "] for [" +
176  jubatus::util::lang::lexical_cast<std::string>(array_.size()));
177  }
178  return array_[index];
179  }

Here is the call graph for this function:

template<typename T>
template<class Buffer >
void jubatus::core::storage::typed_column< T >::pack_array ( msgpack::packer< Buffer > &  packer) const
inline

Definition at line 202 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_.

202  {
203  packer.pack(array_);
204  }
template<typename T>
void jubatus::core::storage::typed_column< T >::pack_with_index ( const uint64_t  index,
framework::packer pk 
) const
inlinevirtual

Reimplemented from jubatus::core::storage::detail::abstract_column_base.

Definition at line 181 of file abstract_column.hpp.

182  {
183  pk.pack((*this)[index]);
184  }
template<typename T>
void jubatus::core::storage::typed_column< T >::push_back ( const T &  value)
inline
template<typename T>
void jubatus::core::storage::typed_column< T >::push_back ( const msgpack::object &  obj)
inline

Definition at line 116 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::push_back().

116  {
117  typed_column::push_back(obj.as<T>());
118  }

Here is the call graph for this function:

template<typename T>
bool jubatus::core::storage::typed_column< T >::remove ( uint64_t  target)
inlinevirtual

Implements jubatus::core::storage::detail::abstract_column_base.

Definition at line 142 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_, jubatus::core::storage::typed_column< T >::size(), jubatus::core::clustering::swap(), and jubatus::core::storage::swap().

142  {
143  if (size() <= target) {
144  return false;
145  }
146  using std::swap;
147  swap(array_[target], array_.back());
148  array_.pop_back();
149  return true;
150  }
void swap(weighted_point &p1, weighted_point &p2)
Definition: types.hpp:47
void swap(lsh_vector &l, lsh_vector &r)
Definition: lsh_vector.hpp:61

Here is the call graph for this function:

template<typename T>
uint64_t jubatus::core::storage::typed_column< T >::size ( ) const
inline
template<typename T>
void jubatus::core::storage::typed_column< T >::unpack_array ( msgpack::object  o)
inline

Definition at line 205 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_.

205  {
206  o.convert(&array_);
207  }
template<typename T>
bool jubatus::core::storage::typed_column< T >::update ( uint64_t  index,
const T &  value 
)
inline

Definition at line 131 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::array_, and jubatus::core::storage::typed_column< T >::size().

Referenced by jubatus::core::storage::typed_column< T >::update(), and jubatus::core::storage::typed_column< bit_vector >::update().

131  {
132  if (size() <= index) {
133  return false;
134  }
135  array_[index] = value;
136  return true;
137  }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
bool jubatus::core::storage::typed_column< T >::update ( uint64_t  target,
const msgpack::object &  obj 
)
inline

Definition at line 138 of file abstract_column.hpp.

References jubatus::core::storage::typed_column< T >::update().

138  {
139  return typed_column::update(target, obj.as<T>());
140  }
bool update(uint64_t index, const T &value)

Here is the call graph for this function:

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const typed_column< T > &  it 
)
friend

Definition at line 186 of file abstract_column.hpp.

187  {
188  os << "[column (" << it.type().type_as_string() << ")"
189  << " size:" << it.size() << " {" << std::endl;
190  for (size_t i = 0; i < it.size(); ++i) {
191  it.dump(os, i);
192  }
193  os << "} ]" << std::endl;
194  return os;
195  }

Member Data Documentation

template<typename T>
std::vector<T> jubatus::core::storage::typed_column< T >::array_
private

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