27 #include "../../common/STLUtils.h"
28 #include "../../common/Translator.h"
29 #include "../../datatype/Enums.h"
30 #include "../../geometry/Envelope.h"
31 #include "../query/And.h"
32 #include "../query/Expression.h"
33 #include "../query/Field.h"
34 #include "../query/In.h"
35 #include "../query/Literal.h"
36 #include "../query/LiteralEnvelope.h"
37 #include "../query/LiteralString.h"
38 #include "../query/ST_Intersects.h"
39 #include "../Exception.h"
51 : m_pnames(rhs.m_pnames),
53 m_ptypes(rhs.m_ptypes),
55 m_expByClauseIn(rhs.m_expByClauseIn)
62 std::set<ObjectId*, te::common::LessCmp<ObjectId*> >::const_iterator it;
63 for(it = rhs.
m_oids.begin(); it != rhs.
m_oids.end(); ++it)
64 m_oids.insert((*it)->clone());
77 assert(!name.empty());
78 m_pnames.push_back(name);
79 m_ppos.push_back(pos);
80 m_ptypes.push_back(type);
93 m_expression = expression;
95 m_expByClauseIn = isClauseIn;
104 setExpression(intersects,
false);
109 assert(m_pnames.size() == m_ptypes.size());
115 for(std::size_t i = 0; i < m_pnames.size(); ++i)
119 in =
new In(m_pnames[i]);
121 in =
new In(source +
"." + m_pnames[i]);
124 std::set<ObjectId*, te::common::LessCmp<ObjectId*> >::const_iterator it;
125 for(it = m_oids.begin(); it != m_oids.end(); ++it)
127 const boost::ptr_vector<te::dt::AbstractData>& data = (*it)->getValue();
152 setExpression(ins,
true);
157 assert(m_pnames.size() == m_ptypes.size());
163 for(std::size_t i = 0; i < m_pnames.size(); ++i)
167 in =
new In(m_pnames[i]);
169 in =
new In(source +
"." + m_pnames[i]);
172 std::set<ObjectId*, te::common::LessCmp<ObjectId*> >::const_iterator it;
173 for(it = m_oids.begin(); it != m_oids.end(); ++it)
175 const boost::ptr_vector<te::dt::AbstractData>& data = (*it)->getValue();
206 return m_expression->
clone();
208 return getExpressionByInClause();
219 return m_oids.size();
240 return m_oids.find(oid) != m_oids.end();
245 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::iterator it = m_oids.find(oid);
247 if(it != m_oids.end())
255 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >& newOids = rhs->
m_oids;
257 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::iterator it;
258 for(it = newOids.begin(); it != newOids.end(); ++it)
259 m_oids.find(*it) == m_oids.end() ? add(*it) :
delete *it;
263 setExpressionByInClause();
276 const std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >& oidsToRemove = rhs->
m_oids;
278 if(oidsToRemove.empty())
281 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
282 for(it = oidsToRemove.begin(); it != oidsToRemove.end(); ++it)
284 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::iterator itSearch = m_oids.find(*it);
286 if(itSearch == m_oids.end())
290 m_oids.erase(itSearch);
293 setExpressionByInClause();
300 const std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >& oidsToInsert = rhs->
m_oids;
302 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
303 for(it = oidsToInsert.begin(); it != oidsToInsert.end(); ++it)
305 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::iterator itSearch = m_oids.find(*it);
307 if(itSearch != m_oids.end())
310 m_oids.erase(itSearch);
313 m_oids.insert((*it)->clone());
316 setExpressionByInClause();
321 return m_oids.begin();
337 getExpressionByInClause();
339 return m_expByClauseIn;
const std::vector< int > & getPropertyTypes() const
It returns the property types used to generated the oids.
void add(Expression *arg)
It adds the argument to the function list of arguments.
bool isExpressionClauseIn() const
The Field class can be used to model an expression that takes part of the output items of a SELECT...
Spatial intersects operator.
te::da::Expression * m_expression
The expression that can be used to retrieve the data set that contains the all indentified elements...
Expression * getExpression() const
It returns the expression set for an output select query.
This class represents an unique id for a data set element.
void addProperty(const std::string &name, std::size_t pos, int type)
It adds a property that will be used to generate the unique ids.
void setExpression(te::da::Expression *expression, bool isClauseIn)
It set the expression that can be used to retrieve the data set that contains the all indentified ele...
This is an abstract class that models a query expression.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
An Envelope defines a 2D rectangular region.
This class models a literal value.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
This class represents an unique id for a data set element.
void setExpressionByInClause(const std::string source="")
std::size_t size() const
It returns the object id set size.
ObjectIdSet()
Constructor.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > > m_oids
The set of unique ids.
void setExpressionByIntersection(std::string geomAttrName, te::gm::Envelope env, int srid)
void symDifference(const ObjectIdSet *rhs)
It performs the symmetric difference operation between this ObjectIdSet and the given ObjectIdSet...
void remove(ObjectId *oid)
Removes the object id from set.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const
Returns an iterator for the object ids in container.
void Union(ObjectIdSet *rhs)
It performs the union operation between this ObjectIdSet and the given ObjectIdSet.
void clear()
It clears this object id set.
bool contains(ObjectId *oid) const
It returns if the object id set contains the given oid.
A class that models a literal for Envelope values.
const std::vector< std::string > & getPropertyNames() const
It returns the property names used to generated the oids.
Expression * getExpressionByInClause(const std::string source="") const
void add(ObjectId *oid)
It adds an object id to this object id set.
A class that represents the IN operator.
const std::vector< std::size_t > & getPropertyPos() const
It returns the property positions used to generated the oids.
virtual Expression * clone() const =0
It creates a new copy of this expression.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
ObjectIdSet * clone() const
Expression * getExpression() const
It returns the expression that can be used to retrieve the data set that contains the all indentified...
std::size_t getNumArgs() const
It returns the number of arguments informed to the function.
void difference(const ObjectIdSet *rhs)
It performs the difference operation between this ObjectIdSet and the given ObjectIdSet.
~ObjectIdSet()
Destructor.
This class models a string Literal value.