25#ifndef FSA_ACCESS_16_H
26#define FSA_ACCESS_16_H
45#include <boost/config.hpp>
48#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
49#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
50#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
51#define U16_GET_SUPPLEMENTARY(lead, trail) \
52(((char32_t)(lead)<<10UL)+(char32_t)(trail)-U16_SURROGATE_OFFSET)
54#define U16_LEAD(supplementary) (char32_t)(((supplementary)>>10)+0xd7c0)
55#define U16_TRAIL(supplementary) (char32_t)(((supplementary)&0x3ff)|0xdc00)
57#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
58#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
59#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
60#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
62#define U16_NEXT(s, i, length, c) { \
63(c)=(s)[(i)++].unicode(); \
66 if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)].unicode())) { \
68 (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
90template <
typename graphType>
98 typedef typename boost::property_map<graphType,boost::vertex_name_t>::const_type
100 typedef typename boost::property_map<graphType,boost::vertex_name_t>::type
105 typedef typename boost::property_map<graphType,vertex_text_t>::const_type
107 typedef typename boost::property_map<graphType,vertex_text_t>::type
112 typedef typename boost::property_map<graphType,vertex_count_t>::const_type
114 typedef typename boost::property_map<graphType,vertex_count_t>::type
122 typedef boost::property< vertex_text_t, LimaString >
128 typedef boost::property< boost::vertex_name_t, VERTEX_PROPERTY_16, dicoVertexTextProperty>
136 typedef boost::adjacency_list<boost::vecS,
138 boost::bidirectionalS,
145 typedef boost::adjacency_list<boost::vecS,
148 boost::bidirectionalS,
154template <
typename vname_map_type,
typename vtext_map_type,
typename vcount_map_type,
158 vtext_map_type vtext_map, vcount_map_type vcount_map);
159 void operator()(std::ostream& out,
const dicoVertex& v)
const;
162 vname_map_type m_vname_map;
163 vtext_map_type m_vtext_map;
164 vcount_map_type m_vcount_map;
170 void operator()(std::ostream& out,
const dicoEdge& edge )
const {
177#define dicoVertexType typename boost::graph_traits<graphType>::vertex_descriptor
179template <
typename graphType>
186 typedef typename boost::graph_traits<graphType>::edge_descriptor
dicoEdgeType;
195 virtual void print( std::ostream &os )
const;
241 const uint64_t offset = 0)
const;
275 int32_t min,
int range,
int nb_unit_for_char )
const;
284 int32_t min,
int range,
int nb_unit_per_char )
const;
291#include "common/FsaAccess/FsaAccess16.tcc"
virtual void addSuffix(dicoVertexType from, PrefixIterator *prefixIt)
void checkIntegrity(dicoVertexType from) const
check integrity of subgraph
void getPrefix(dicoVertexType &from, PrefixIterator *prefixIt) const
Recursively goes through the graph from from, following edges labelled by the prefix iterator chars.
dicoVertexType m_rootVertex
int32_t findEdge(const char32_t searchChar, const LimaString &textString, int32_t min, int range, int nb_unit_for_char) const
find the right offset in the vector of out_edge: search for the character currentChar in the string t...
virtual void print(std::ostream &os) const
bool equivalent(dicoVertexType referenceState, dicoVertexType candidateState) const
are both state equivalent? We assume that edges are ordered
void writeBody(AbstractFsaAccessOStreamWrapper &ow)
std::pair< const dicoVertexType, bool > findEquivalentInRegister(dicoVertexType tempState)
Search for equivalent state in register.
virtual void printGraph(std::ostream &os) const
void readBody(AbstractFsaAccessIStreamWrapper &iw)
FsaAccess16(bool trie_direction_fwd)
PrefixIterator * getPrefixIterator(const LimaString &word, const uint64_t offset=0) const
For all navigation Factory of prefixIterator (prefixIt depends on direction: forward/reverse)
selected_graph_types16::dicoVertexStatusProperty dicoVertexProperty
dicoVertexType m_0degreeOutVertex
boost::graph_traits< graphType >::edge_descriptor dicoEdgeType
type of vertex descriptor type of edge descriptor
void writeVertices(AbstractFsaAccessOStreamWrapper &ow, FsaAccessIOHandler< graphType > *iOHandler, dicoVertexType from)
Parcours recursif du graphe avec creation d'un tableau de conversion ptr -> Id On renomme les noeuds ...
int32_t findOffsetToInsertBefore(const char32_t searchChar, const LimaString &textString, int32_t min, int range, int nb_unit_per_char) const
find where to insert currentChar in the string text using dichotomy search (assume characters are ord...
virtual FsaAccessIOHandler< graphType > * getFsaAccessIOHandler() const =0
For IO Factory of IO Handler: Handler depends on graphType: with mapping or not.
boost::graph_traits< graphType >::degree_size_type dico_degree_size_type
void operator()(std::ostream &out, const dicoEdge &edge) const
void operator()(std::ostream &out, const dicoVertex &v) const
dicoVertexWriter16(vname_map_type vname_map, vtext_map_type vtext_map, vcount_map_type vcount_map)
BOOST_INSTALL_PROPERTY(vertex, text)
boost::property_map< graphType, boost::vertex_name_t >::const_type vname_map_type
boost::property_map< graphType, vertex_count_t >::type nconst_vcount_map_type
boost::property_map< graphType, vertex_count_t >::const_type vcount_map_type
boost::property_map< graphType, vertex_text_t >::type nconst_vtext_map_type
boost::property_map< graphType, vertex_text_t >::const_type vtext_map_type
boost::property_map< graphType, boost::vertex_name_t >::type nconst_vname_map_type
boost::adjacency_list< boost::vecS, boost::listS, boost::bidirectionalS, dicoVertexCountProperty > builderGraphType
Graph used for FsaDictBuilder container types are chosen for their efficiency in insertion bidirectio...
boost::property< boost::vertex_name_t, VERTEX_PROPERTY_16, dicoVertexTextProperty > dicoVertexStatusProperty
Declare a property (vertex_name) of type uint8_t to store vertex quality : (qualifer & 1) == 1: final...
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, dicoVertexCountProperty > spareGraphType
Graph used for FsaDictSpare container types are chosen for their minimal size.
boost::property< vertex_count_t, std::vector< int >, dicoVertexStatusProperty > dicoVertexCountProperty
Declare a property (vertex_count) of type std::vector<int> to store count of sub automata (to compute...
boost::property< vertex_text_t, LimaString > dicoVertexTextProperty
Declare a property (vertex_text) of type LimaString to store more efficiently edge label.