<commit_before>#ifndef     CHUNK_FACTORY_H_
# define    CHUNK_FACTORY_H_

#include <pcl/common/common.h>
#include "pcl/impl/point_types.hpp"
#include "slam/Landmarks.hh"
#include "utils/NonCopyable.h"

#include <vector>
#include <string>
#include <deque>

namespace Network
{

/**
 * @class ChunkFactory
 * @brief Split 3D information into chunks to sent it through UDP.
 * @details The maximum size of a chunk is 512 Bytes.
 * (but if we analyse the MTU we can make this size dynamique).
 * The classes encoded are tagged with:
 * "P(" ")" for pcl::PointCloud::PointXYZ
 * "L(" ")" for Landmarks::Landmark
 * @author Maxence
 * @version 0.3
 */
class   ChunkFactory
{
public:
  ChunkFactory();
  ~ChunkFactory();

  void  processData(const std::vector<Landmarks::Landmark>&);
  void  processData(const Landmarks::Landmark&);
  void  processData(const pcl::PointCloud<pcl::PointXYZ>&);

  // Getters
  bool  isFullChunkReady() const;
  bool  isChunkReady() const;

  std::string   getChunk();

private:
  void          pushChunkToChunks();
  void          addEncodedClassToChunk(const std::string&);

  std::string   fromLandmarkToString(const Landmarks::Landmark&);
  std::string   fromPclPointCloudToString(const pcl::PointCloud<pcl::PointXYZ>&);
  std::string   fromPclPointToString(const pcl::PointXY&);
  std::string   fromPclPointToString(const pcl::PointXYZ&);

  std::string   encodeNbIntoString(void*, unsigned long);

  void          increaseSizeChunks(unsigned int);
  void          decreaseSizeChunks(unsigned int);

  NON_COPYABLE(ChunkFactory)

  // ATTRIBUTES
  std::deque<std::string>       _chunks; // max size 1Mo?
  std::string                   _tmpChunk; // fill it, push it to _chunks

  bool          _fullChunkReadiness; // true: there is at least 1 chunk in _chunks
  bool          _chunkReadiness; // true: _tmpChunk is not empty neither full
  unsigned int  _sizeChunks;
  unsigned int  _maxSizeChunk; // could also depend on the MTU
};

} // end of namespace

#endif<commit_msg>ChunkFactory: add doxygen doc on instance variables.<commit_after>#ifndef     CHUNK_FACTORY_H_
# define    CHUNK_FACTORY_H_

#include <pcl/common/common.h>
#include "pcl/impl/point_types.hpp"
#include "slam/Landmarks.hh"
#include "utils/NonCopyable.h"

#include <vector>
#include <string>
#include <deque>

namespace Network
{

/**
 * @class ChunkFactory
 * @brief Split 3D information into chunks to sent it through UDP.
 * @details The maximum size of a chunk is 512 Bytes.
 * (but if we analyse the MTU we can make this size dynamique).
 * The classes encoded are tagged with:
 * "P(" ")" for pcl::PointCloud::PointXYZ
 * "L(" ")" for Landmarks::Landmark
 * @author Maxence
 * @version 0.3
 */
class   ChunkFactory
{
public:
  ChunkFactory();
  ~ChunkFactory();

  void  processData(const std::vector<Landmarks::Landmark>&);
  void  processData(const Landmarks::Landmark&);
  void  processData(const pcl::PointCloud<pcl::PointXYZ>&);

  // Getters
  bool  isFullChunkReady() const;
  bool  isChunkReady() const;

  std::string   getChunk();

private:
  void          pushChunkToChunks();
  void          addEncodedClassToChunk(const std::string&);

  std::string   fromLandmarkToString(const Landmarks::Landmark&);
  std::string   fromPclPointCloudToString(const pcl::PointCloud<pcl::PointXYZ>&);
  std::string   fromPclPointToString(const pcl::PointXY&);
  std::string   fromPclPointToString(const pcl::PointXYZ&);

  std::string   encodeNbIntoString(void*, unsigned long);

  void          increaseSizeChunks(unsigned int);
  void          decreaseSizeChunks(unsigned int);

  NON_COPYABLE(ChunkFactory)

  // ATTRIBUTES
  std::deque<std::string>       _chunks; /*!< contain all ready chunks, max size? */
  std::string                   _tmpChunk; /*!< fill it, push it to _chunks */

  bool          _fullChunkReadiness; /*!< true: there is at least 1 chunk in _chunks */
  bool          _chunkReadiness; /*!< true: _tmpChunk is not empty neither full */
  unsigned int  _sizeChunks; /*!< Total size of chunks in _chunks */
  unsigned int  _maxSizeChunk; /*!< could also depend on the MTU */
};

} // end of namespace

#endif
{'fraction_non_alphanumeric': 0.11623972933784436, 'fraction_numerical': 0.003624939584340261, 'mean_word_length': 3.8466042154566744, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1857085', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1315, 'n_words': 360}