diff --git a/alib2common/src/primitive/Bool.h b/alib2common/src/primitive/Bool.h index 4e98b4dfbe3c16a79ee094dd72f17e9c4b1720fe..c1e6c50256b4af824a13ef23c725ad68d34257d0 100644 --- a/alib2common/src/primitive/Bool.h +++ b/alib2common/src/primitive/Bool.h @@ -1,6 +1,22 @@ /* * Bool.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,48 +29,87 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a boolean datatype. */ class Bool final : public PrimitiveBase { -protected: + /** + * \brief + * The stored boolean value. + */ bool m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided boolean value. + * + * \param data the boolean value to wrap */ explicit Bool ( bool data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored boolean value. + * + * \return the stored boolean value */ bool getData ( ) const; + /** + * \brief + * Cast operator to the boolean type. The result of the cast is the stored boolean value. + */ explicit operator bool ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new boolean value to store. */ void setData ( bool data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const Bool & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const Bool & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/Character.h b/alib2common/src/primitive/Character.h index 77cf8a201d437eacaaa0a638b57ef5855044fa63..0f531f52cc43891ecae97c8a89a0b9811a8fa6b9 100644 --- a/alib2common/src/primitive/Character.h +++ b/alib2common/src/primitive/Character.h @@ -1,6 +1,22 @@ /* * Character.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,48 +29,87 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a character datatype. */ class Character final : public PrimitiveBase { -protected: + /** + * \brief + * The stored character value. + */ char m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided character value. + * + * \param data the character value to wrap */ explicit Character ( char data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored character value. + * + * \return the stored character value */ char getData ( ) const; + /** + * \brief + * Cast operator to the character type. The result of the cast is the stored character value. + */ explicit operator char ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new character value to store. */ void setData ( char data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const Character & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const Character & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/Double.h b/alib2common/src/primitive/Double.h index 835f064ca6b3a047b1224d4d78c4db1d575a1a0c..59b8c83e702a307a3ee58288fedd495120d496e0 100644 --- a/alib2common/src/primitive/Double.h +++ b/alib2common/src/primitive/Double.h @@ -1,6 +1,22 @@ /* * Double.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,48 +29,87 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a double datatype. */ class Double final : public PrimitiveBase { -protected: + /** + * \brief + * The stored double value. + */ int m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided double value. + * + * \param data the double value to wrap */ explicit Double ( double data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored double value. + * + * \return the stored double value */ double getData ( ) const; + /** + * \brief + * Cast operator to the double type. The result of the cast is the stored double value. + */ explicit operator double ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new double value to store. */ void setData ( double data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const Double & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const Double & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/Integer.h b/alib2common/src/primitive/Integer.h index e29f2df6f250cd8e525feaa9f1c5ed724c9a0fda..daaa0bcbab40064966da1ab64309c62a5081c377 100644 --- a/alib2common/src/primitive/Integer.h +++ b/alib2common/src/primitive/Integer.h @@ -1,6 +1,22 @@ /* * Integer.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,48 +29,87 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a integer datatype. */ class Integer final : public PrimitiveBase { -protected: + /** + * \brief + * The stored integer value. + */ int m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided integer value. + * + * \param data the integer value to wrap */ explicit Integer ( int data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored integer value. + * + * \return the stored integer value */ int getData ( ) const; + /** + * \brief + * Cast operator to the integer type. The result of the cast is the stored integer value. + */ explicit operator int ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new integer value to store. */ void setData ( int data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const Integer & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const Integer & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/PrimitiveBase.h b/alib2common/src/primitive/PrimitiveBase.h index ea0c76c5bc79ac04cfe8edfd716f44634f6f9b27..26aa53a5f89092893b099c954c1210085072c83e 100644 --- a/alib2common/src/primitive/PrimitiveBase.h +++ b/alib2common/src/primitive/PrimitiveBase.h @@ -1,6 +1,22 @@ /* * PrimitiveBase.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Apr 10, 2013 * Author: Jan Travnicek */ @@ -13,14 +29,24 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief Represents base for a concrete primitive type wrapper. */ class PrimitiveBase : public object::ObjectBase { public: - virtual PrimitiveBase* clone ( ) const & = 0; - virtual PrimitiveBase* clone() && = 0; + /** + * @copydoc ObjectBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override = 0; + + /** + * @copydoc ObjectBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override = 0; - virtual PrimitiveBase* inc() && = 0; + /** + * @copydoc ObjectBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override = 0; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/String.cpp b/alib2common/src/primitive/String.cpp index d74c08d0d62b7d405e4a859f5d5df6d29ebe0647..a309247eccdbaafc4820e07bfbdb1ccb45672b91 100644 --- a/alib2common/src/primitive/String.cpp +++ b/alib2common/src/primitive/String.cpp @@ -26,12 +26,16 @@ PrimitiveBase* String::clone() && { return new String(std::move(*this)); } -const std::string& String::getData() const { +const std::string & String::getData ( ) const & { return m_data; } -std::string& String::getData() { - return m_data; +std::string && String::getData ( ) && { + return std::move ( m_data ); +} + +void String::setData ( std::string data ) { + m_data = std::move ( data ); } int String::compare(const String& other) const { diff --git a/alib2common/src/primitive/String.h b/alib2common/src/primitive/String.h index 521fb85006185ebabceabdceddba44e3c353c78b..a1196571cb7203dc0db5c4eef86ae7aea882a01b 100644 --- a/alib2common/src/primitive/String.h +++ b/alib2common/src/primitive/String.h @@ -1,5 +1,21 @@ /* - * StringLabel.h + * String.h + * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. * * Created on: Mar 26, 2013 * Author: Jan Travnicek @@ -14,47 +30,95 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a string datatype. */ class String final : public PrimitiveBase { -protected: + /** + * \brief + * The stored string value. + */ std::string m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided string value. + * + * \param data the string value to wrap */ explicit String ( std::string data ); + /** + * \brief + * Creates new instance holding provided c-string value. + * + * \param data the string value to wrap + */ explicit String ( const char * data ); + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ virtual PrimitiveBase * clone ( ) &&; /** - * @return name of the symbol + * Getter of the stored string value. + * + * \return the stored string value */ - const std::string & getData ( ) const; + const std::string & getData ( ) const &; /** - * @return name of the symbol + * Getter of the stored string value. + * + * \return the stored string value */ - std::string & getData ( ); + std::string && getData ( ) &&; + /** + * Setter of a new value. + * + * \param data a new string value to store. + */ + void setData ( std::string data ); + + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ virtual int compare ( const ObjectBase & other ) const { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ virtual int compare ( const String & other ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ virtual explicit operator std::string ( ) const; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ virtual PrimitiveBase * inc ( ) &&; }; diff --git a/alib2common/src/primitive/Unsigned.h b/alib2common/src/primitive/Unsigned.h index db4e0c8438a08bfc935a3d8bffd04adafdf262c9..9b50bda90e8274f06e76f7527dbb82bc4d04c339 100644 --- a/alib2common/src/primitive/Unsigned.h +++ b/alib2common/src/primitive/Unsigned.h @@ -1,6 +1,22 @@ /* * Unsigned.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,50 +29,93 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a unsigned datatype. */ class Unsigned final : public PrimitiveBase { -protected: + /** + * \brief + * The stored unsigned value. + */ unsigned m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided unsigned value. + * + * \param data the unsigned value to wrap */ explicit Unsigned ( unsigned data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored unsigned value. + * + * \return the stored unsigned value */ unsigned getData ( ) const; + /** + * \brief + * Cast operator to the unsigned type. The result of the cast is the stored unsigned value. + */ explicit operator unsigned ( ) const; + /** + * \brief + * Cast operator to the size_t type. The result of the cast is the promoted stored unsigned value. + */ explicit operator size_t ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new unsigned value to store. */ void setData ( unsigned data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const Unsigned & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const Unsigned & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */ diff --git a/alib2common/src/primitive/UnsignedLong.h b/alib2common/src/primitive/UnsignedLong.h index b00b3389251e226511bad160adb1367ea8aff318..6398068781d7125c4f23b5ccdc5ad0db63e279f9 100644 --- a/alib2common/src/primitive/UnsignedLong.h +++ b/alib2common/src/primitive/UnsignedLong.h @@ -1,6 +1,22 @@ /* * UnsignedLong.h * + * This file is part of Algorithms library toolkit. + * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) + + * Algorithms library toolkit 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 3 of the License, or + * (at your option) any later version. + + * Algorithms library toolkit 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 Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. + * * Created on: Mar 26, 2013 * Author: Jan Travnicek */ @@ -13,48 +29,87 @@ namespace primitive { /** - * Represents symbol in an alphabet. + * \brief + * Represents a wrapper of a unsigned long datatype. */ class UnsignedLong final : public PrimitiveBase { -protected: + /** + * \brief + * The stored unsigned long value. + */ unsigned long m_data; public: /** - * Creates new symbol with given name. - * @param symbol name of the symbol + * \brief + * Creates new instance holding provided unsigned long value. + * + * \param data the unsigned long value to wrap */ explicit UnsignedLong ( unsigned long data ); - virtual PrimitiveBase * clone ( ) const &; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) const & + */ + virtual PrimitiveBase * clone ( ) const & override; - virtual PrimitiveBase * clone ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::clone ( ) && + */ + virtual PrimitiveBase * clone ( ) && override; /** - * @return name of the symbol + * Getter of the stored unsigned long value. + * + * \return the stored unsigned long value */ unsigned long getData ( ) const; + /** + * \brief + * Cast operator to the unsigned long type. The result of the cast is the stored unsigned long value. + */ explicit operator unsigned long ( ) const; /** - * sets new content of primitive + * Setter of a new value. + * + * \param data a new unsigned long value to store. */ void setData ( unsigned long data ); - virtual int compare ( const ObjectBase & other ) const { + /** + * @copydoc base::CommonBase < ObjectBase >::compare ( const ObjectBase & ) const + */ + virtual int compare ( const ObjectBase & other ) const override { if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); } - virtual int compare ( const UnsignedLong & other ) const; + /** + * The actual compare method + * + * \param other the other instance + * + * \returns the actual relation between two by type same primitives + */ + int compare ( const UnsignedLong & other ) const; - virtual void operator >>( std::ostream & ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator >> ( std::ostream & ) const + */ + virtual void operator >>( std::ostream & ) const override; - virtual explicit operator std::string ( ) const; + /** + * @copydoc base::CommonBase < ObjectBase >::operator std::string ( ) const + */ + virtual explicit operator std::string ( ) const override; - virtual PrimitiveBase * inc ( ) &&; + /** + * @copydoc primitive::PrimitiveBase::inc ( ) && + */ + virtual PrimitiveBase * inc ( ) && override; }; } /* namespace primitive */