LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rcsc::FormationData Class Reference

data for constructing the formation More...

#include <formation_data.h>

Classes

struct  Data
 training data element. More...
 

Public Types

typedef std::shared_ptr< FormationDataPtr
 
typedef std::shared_ptr< const FormationDataConstPtr
 
typedef std::list< DataDataCont
 data container type.
 

Public Member Functions

 FormationData ()
 default constructor.
 
virtual ~FormationData ()
 virtual destructor.
 
void clear ()
 clear all data.
 
const DataContdataCont () const
 create default data. ‍/ void createDefault(); More...
 
const Datadata (const size_t idx) const
 get the specified index data. More...
 
int nearestDataIndex (const Vector2D &pos, const double dist_thr) const
 get the data index nearest to the input point. More...
 
bool existTooNearData (const Data &data) const
 check if there are exsiting data near to input data. More...
 
std::string addData (const Data &data)
 append new data. More...
 
std::string insertData (const size_t idx, const Data &data)
 insert new data just before the input index. More...
 
std::string replaceData (const size_t idx, const Data &data)
 replace exsiting data at input index with input data. More...
 
std::string removeData (const size_t idx)
 delete exsiting data at input index. More...
 
std::string changeDataIndex (const size_t old_idx, const size_t new_idx)
 move the specified data to new index position. More...
 
std::ostream & print (std::ostream &os) const
 print data in JSON format More...
 
bool read (std::istream &is)
 read data in JSON format More...
 

Static Public Member Functions

static double round_xy (const double xy)
 
static rcsc::Vector2D rounded_vector (const double x, const double y)
 

Static Public Attributes

static const double PRECISION
 coordinates value precision
 
static const size_t MAX_DATA_SIZE
 max data size
 
static const double NEAR_DIST_THR
 data distance threshold
 

Detailed Description

data for constructing the formation

Member Function Documentation

◆ addData()

std::string rcsc::FormationData::addData ( const Data data)

append new data.

Parameters
datanew data.
Returns
error message if error occurd. otherwise, empty string.

◆ changeDataIndex()

std::string rcsc::FormationData::changeDataIndex ( const size_t  old_idx,
const size_t  new_idx 
)

move the specified data to new index position.

Parameters
old_idxold index.
new_idxnew index.
Returns
error message if error occurd. otherwise, empty string.

◆ data()

const Data * rcsc::FormationData::data ( const size_t  idx) const

get the specified index data.

Returns
const pointer to the data. if no matched data, NULL is returned.

◆ dataCont()

const DataCont & rcsc::FormationData::dataCont ( ) const
inline

create default data. ‍/ void createDefault();

/*!
  \brief get the data container.
  \return data container.

◆ existTooNearData()

bool rcsc::FormationData::existTooNearData ( const Data data) const

check if there are exsiting data near to input data.

Parameters
datainput data.
Returns
checked result.

◆ insertData()

std::string rcsc::FormationData::insertData ( const size_t  idx,
const Data data 
)

insert new data just before the input index.

Parameters
idxtarget index.
datanew data.
Returns
error message if error occurd. otherwise, empty string.

◆ nearestDataIndex()

int rcsc::FormationData::nearestDataIndex ( const Vector2D pos,
const double  dist_thr 
) const

get the data index nearest to the input point.

Parameters
posinput point.
dist_thrdistance threshold
Returns
index of the result data. -1 if no result

◆ print()

std::ostream & rcsc::FormationData::print ( std::ostream &  os) const

print data in JSON format

Parameters
osoutput stream.
Returns
output stream.

◆ read()

bool rcsc::FormationData::read ( std::istream &  is)

read data in JSON format

Parameters
isinput stream.
Returns
input stream.

◆ removeData()

std::string rcsc::FormationData::removeData ( const size_t  idx)

delete exsiting data at input index.

Parameters
idxinput index.
Returns
error message if error occurd. otherwise, empty string.

◆ replaceData()

std::string rcsc::FormationData::replaceData ( const size_t  idx,
const Data data 
)

replace exsiting data at input index with input data.

Parameters
idxtarget index.
datanew data.
Returns
error message if error occurd. otherwise, empty string.

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