-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-// cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore //
+// //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
+// //
+// See project site at http://redmine.teslayout.com/projects/anna-suite //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
#include <stdlib.h>
// static
template <class T, class M> comm::Variable* insert(const char* name, const short int id, M& theVector, T& value)
-throw(RuntimeException) {
+noexcept(false) {
comm::Variable* result = theVector.find(id);
if(result != NULL)
// static
template <class T, class M> comm::Variable* insertRef(const char* name, const short int id, M& theVector, T& value)
-throw(RuntimeException) {
+noexcept(false) {
comm::Variable* result = theVector.find(id);
if(result != NULL)
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, std::string& value)
-throw(RuntimeException) {
+noexcept(false) {
return insert(name, id, a_variables, value);
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, int& value)
-throw(RuntimeException) {
+noexcept(false) {
const int backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, S64& value)
-throw(RuntimeException) {
+noexcept(false) {
const S64 backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, bool& value)
-throw(RuntimeException) {
+noexcept(false) {
const bool backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, DataBlock& value)
-throw(RuntimeException) {
+noexcept(false) {
return insert(name, id, a_variables, value);
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, float& value)
-throw(RuntimeException) {
+noexcept(false) {
const float backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, double& value)
-throw(RuntimeException) {
+noexcept(false) {
const double backup(value);
const Variable* result = insert(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, Second& value)
-throw(RuntimeException) {
+noexcept(false) {
const Second backup(value);
const Variable* result = insertRef(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, Millisecond& value)
-throw(RuntimeException) {
+noexcept(false) {
const Millisecond backup(value);
const Variable* result = insertRef(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, Microsecond& value)
-throw(RuntimeException) {
+noexcept(false) {
const Microsecond backup(value);
const Variable* result = insertRef(name, id, a_variables, value);
value = backup;
}
const comm::Variable* comm::CompatCodec::attach(const char* name, const short int id, comm::CompatCodec& value)
-throw(RuntimeException) {
+noexcept(false) {
if(&value == this) {
String msg("comm::CompatCodec::attach | Variable: ");
msg << name << " | Can not link with itself";
}
void comm::CompatCodec::setNull(const short int id, const bool isNull)
-throw(RuntimeException) {
+noexcept(false) {
Variable* variable = a_variables.find(id);
if(variable == NULL)
}
void comm::CompatCodec::setNull(const comm::Variable* variable, const bool isNull)
-throw() {
+{
if(variable->isNull()) {
if(isNull == false) a_nullCounter --;
}
}
bool comm::CompatCodec::isNull(const short int id) const
-throw(RuntimeException) {
+noexcept(false) {
const Variable* variable = a_variables.find(id);
if(variable == NULL)
}
const comm::Variable& comm::CompatCodec::find(const short int id) const
-throw(RuntimeException) {
+noexcept(false) {
const Variable* variable = a_variables.find(id);
if(variable == NULL)
// la recogida de datos.
//-----------------------------------------------------------------------
const DataBlock& comm::CompatCodec::code()
-throw(RuntimeException) {
+noexcept(false) {
unsigned char c(0);
iterator ii;
iterator maxii(a_variables.end());
//-------------------------------------------------------------------------------------------
void comm::CompatCodec::decode(const DataBlock& dataBlock)
-throw(RuntimeException) {
+noexcept(false) {
const char* data = dataBlock.getData();
const int size = dataBlock.getSize();
// Decodifica los buffers que pueden contener variables nulas.
//-------------------------------------------------------------------------------------------
void comm::CompatCodec::normalDecode(const char* data, const int size, const int maxdata)
-throw(RuntimeException) {
+noexcept(false) {
// Mientras no se demuestre lo contrario todas las variables son nulas
a_nullCounter = a_variables.size();
// (1) El codigo de la variable
//-------------------------------------------------------------------------------------------
bool comm::CompatCodec::optimizedDecode(const char* data, const int size)
-throw(RuntimeException) {
+noexcept(false) {
int nbytes;
Variable* variable;
const char* top = data + size;
}
comm::CompatCodec::Type comm::CompatCodec::getType(const DataBlock& dataBlock)
-throw(RuntimeException) {
+noexcept(false) {
const int size(dataBlock.getSize());
if(size <= 1)
}
void comm::CompatCodec::VariableContainer::add(comm::Variable* variable)
-throw() {
+{
if(a_size == a_maxSize) {
int maxSize = (a_maxSize << 1) - (a_maxSize >> 1);
Variable** variables = new Variable* [maxSize];
}
comm::Variable* comm::CompatCodec::VariableContainer::find(const int id)
-throw() {
+{
for(int ii = 0; ii < a_size; ii ++) {
if(a_variables [ii]->getId() == id)
return a_variables [ii];
}
const comm::Variable* comm::CompatCodec::VariableContainer::find(const int id) const
-throw() {
+{
for(int ii = 0; ii < a_size; ii ++) {
if(a_variables [ii]->getId() == id)
return a_variables [ii];
}
void comm::CompatCodec::VariableContainer::clear()
-throw() {
+{
delete [] a_variables;
a_maxSize = a_size = 0;
}