Files
secondo/Algebras/SymbolicTrajectory/Assign.cpp
2026-01-23 17:03:45 +08:00

133 lines
3.3 KiB
C++

/*
----
This file is part of SECONDO.
Copyright (C) 2004, University in Hagen, Department of Computer Science,
Database Systems for New Applications.
SECONDO is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
SECONDO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SECONDO; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
----
//paragraph [1] Title: [{\Large \bf \begin {center}] [\end {center}}]
//[TOC] [\tableofcontents]
Started March 2012, Fabio Vald\'{e}s
[TOC]
\section{Overview}
This is the implementation of the Symbolic Trajectory Algebra.
\section{Defines and Includes}
*/
#include "Algorithms.h"
using namespace temporalalgebra;
using namespace std;
namespace stj{
/*
\subsection{Functions supporting ~rewrite~}
*/
void Assign::setLabelPtr(unsigned int pos, const string& value) {
if (pos < pointers[0].size()) {
((Label*)pointers[0][pos])->Set(true, value);
}
}
void Assign::setPlacePtr(unsigned int pos,
const pair<string, unsigned int>& value) {
if (pos < pointers[1].size()) {
((Place*)pointers[1][pos])->Set(true, value);
}
}
void Assign::setTimePtr(unsigned int pos, const SecInterval& value) {
if (pos < pointers[2].size()) {
*((SecInterval*)pointers[2][pos]) = value;
}
}
void Assign::setStartPtr(unsigned int pos, const Instant& value) {
if (pos < pointers[3].size()) {
*((Instant*)pointers[3][pos]) = value;
}
}
void Assign::setEndPtr(unsigned int pos, const Instant& value) {
if (pos < pointers[4].size()) {
*((Instant*)pointers[4][pos]) = value;
}
}
void Assign::setLeftclosedPtr(unsigned int pos, bool value) {
if (pos < pointers[5].size()) {
((CcBool*)pointers[5][pos])->Set(true, value);
}
}
void Assign::setRightclosedPtr(unsigned int pos, bool value) {
if (pos < pointers[6].size()) {
((CcBool*)pointers[6][pos])->Set(true, value);
}
}
void Assign::cleanLabelsPtr(unsigned int pos) {
if (pos < pointers[8].size()) {
((Labels*)pointers[8][pos])->Clean();
}
}
void Assign::appendToLabelsPtr(unsigned int pos, const string& value) {
if (pos < pointers[8].size()) {
((Labels*)pointers[8][pos])->Append(value);
}
}
void Assign::appendToLabelsPtr(unsigned int pos, const set<string>& values) {
if (pos < pointers[8].size()) {
((Labels*)pointers[8][pos])->Append(values);
}
}
void Assign::cleanPlacesPtr(unsigned int pos) {
if (pos < pointers[9].size()) {
((Places*)pointers[9][pos])->Clean();
}
}
void Assign::appendToPlacesPtr(unsigned int pos,
const pair<string, unsigned int>& value) {
if (pos < pointers[9].size()) {
((Places*)pointers[9][pos])->Append(value);
}
}
void Assign::appendToPlacesPtr(unsigned int pos,
const set<pair<string, unsigned int> >& values) {
if (pos < pointers[9].size()) {
((Places*)pointers[9][pos])->Append(values);
}
}
}