X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FAny.cxx;h=cda84b110d7e5bea36988cc02db4039941bdcf9d;hb=1894c52d0838df8676e770bef061fc23ca436452;hp=598986fc3caddd173402112d059dfb842fdfb276;hpb=f326fbedf87cbffb501f1c677c10222468e4e3f4;p=modules%2Fyacs.git diff --git a/src/engine/Any.cxx b/src/engine/Any.cxx index 598986fc3..cda84b110 100644 --- a/src/engine/Any.cxx +++ b/src/engine/Any.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2020 CEA/DEN, EDF R&D +// Copyright (C) 2006-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -336,12 +336,12 @@ AtomAny *AtomAny::New(const std::string& val, TypeCode *type) return new AtomAny(val,type); } -AnyPtr AtomAny::operator[](int i) const throw(YACS::Exception) +AnyPtr AtomAny::operator[](int i) const { throw InvalidExtractionException(_type->kind(),Sequence); } -AnyPtr AtomAny::operator[](const char *key) const throw(YACS::Exception) +AnyPtr AtomAny::operator[](const char *key) const { throw Exception("AtomAny::operator[] : try to get a part of a partitionned data whereas atomical."); } @@ -363,7 +363,7 @@ bool AtomAny::operator ==(const Any& other) const return false; } -int AtomAny::getIntValue() const throw(YACS::Exception) +int AtomAny::getIntValue() const { if(_type->isA(Runtime::_tc_int)) return _value._i; @@ -371,7 +371,7 @@ int AtomAny::getIntValue() const throw(YACS::Exception) throw Exception("Value is not an int"); } -bool AtomAny::getBoolValue() const throw(YACS::Exception) +bool AtomAny::getBoolValue() const { if(_type->isA(Runtime::_tc_bool)) return _value._b; @@ -379,7 +379,7 @@ bool AtomAny::getBoolValue() const throw(YACS::Exception) throw Exception("Value is not a bool"); } -double AtomAny::getDoubleValue() const throw(YACS::Exception) +double AtomAny::getDoubleValue() const { if(_type->isA(Runtime::_tc_double)) return _value._d; @@ -387,7 +387,7 @@ double AtomAny::getDoubleValue() const throw(YACS::Exception) throw Exception("Value is not a double"); } -std::string AtomAny::getStringValue() const throw(YACS::Exception) +std::string AtomAny::getStringValue() const { if(_type->isA(Runtime::_tc_string) || _type->kind()==YACS::ENGINE::Objref) { @@ -507,33 +507,33 @@ ComposedAny::ComposedAny(TypeCode* type, bool isNew):Any(type) _type->decrRef(); } -AnyPtr ComposedAny::operator[](const char *key) const throw(YACS::Exception) +AnyPtr ComposedAny::operator[](const char *key) const { throw Exception("AtomAny::operator[] : try to get a part of a partitionned data not localizable by a string."); } -void ComposedAny::checkTypeOf(const Any *elem) const throw(YACS::Exception) +void ComposedAny::checkTypeOf(const Any *elem) const { if(!elem->getType()->isA(_type->contentType())) throw Exception("ComposedAny::checkTypeOf : invalid type."); } -int ComposedAny::getIntValue() const throw(YACS::Exception) +int ComposedAny::getIntValue() const { throw InvalidExtractionException(_type->kind(),Runtime::_tc_int->kind()); } -bool ComposedAny::getBoolValue() const throw(YACS::Exception) +bool ComposedAny::getBoolValue() const { throw InvalidExtractionException(_type->kind(),Runtime::_tc_bool->kind()); } -double ComposedAny::getDoubleValue() const throw(YACS::Exception) +double ComposedAny::getDoubleValue() const { throw InvalidExtractionException(_type->kind(),Runtime::_tc_double->kind()); } -std::string ComposedAny::getStringValue() const throw(YACS::Exception) +std::string ComposedAny::getStringValue() const { throw InvalidExtractionException(_type->kind(),Runtime::_tc_string->kind()); } @@ -693,14 +693,14 @@ bool SequenceAny::operator ==(const Any& other) const return true; } -void SequenceAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception) +void SequenceAny::setEltAtRank(int i, const Any *elem) { checkTypeOf(elem); _alloc.destroy(_alloc._start+i*_alloc._sizeOf1Elm,_type->contentType()); _alloc.construct(_alloc._start+i*_alloc._sizeOf1Elm,elem); } -AnyPtr SequenceAny::operator[](int i) const throw(YACS::Exception) +AnyPtr SequenceAny::operator[](int i) const { return _type->contentType()->getOrBuildAnyFromZippedData(_alloc._start+i*_alloc._sizeOf1Elm); } @@ -972,7 +972,7 @@ ArrayAny::ArrayAny(const std::vector& val):ComposedAny(new TypeCode } } -void ArrayAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception) +void ArrayAny::setEltAtRank(int i, const Any *elem) { checkTypeOf(elem); const TypeCode *subType=_type->contentType(); @@ -991,7 +991,7 @@ bool ArrayAny::operator ==(const Any& other) const return true; } -AnyPtr ArrayAny::operator[](int i) const throw(YACS::Exception) +AnyPtr ArrayAny::operator[](int i) const { const TypeCode *subType=_type->contentType(); unsigned sizePerContent=subType->getSizeInByteOfAnyReprInSeq(); @@ -1069,13 +1069,13 @@ bool StructAny::operator ==(const Any& other) const return true; } -AnyPtr StructAny::operator[](int i) const throw(YACS::Exception) +AnyPtr StructAny::operator[](int i) const { const char what[]="StructAny::operator[](int i) : Struct key are strings not integers."; throw Exception(what); } -AnyPtr StructAny::operator[](const char *key) const throw(YACS::Exception) +AnyPtr StructAny::operator[](const char *key) const { const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type; char *whereToGet=_data; @@ -1093,13 +1093,13 @@ AnyPtr StructAny::operator[](const char *key) const throw(YACS::Exception) return (*iter).second->getOrBuildAnyFromZippedData(whereToGet); } -void StructAny::setEltAtRank(int i, const Any *elem) throw(YACS::Exception) +void StructAny::setEltAtRank(int i, const Any *elem) { const char what[]="Struct key are strings not integers."; throw Exception(what); } -void StructAny::setEltAtRank(const char *key, const Any *elem) throw(YACS::Exception) +void StructAny::setEltAtRank(const char *key, const Any *elem) { const TypeCodeStruct *typeC=(const TypeCodeStruct *)_type; unsigned offset;