Back to index

salome-kernel  6.5.0
SALOMEDS_TMPFile_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
00024 //  File   : SALOMEDSImpl_SObject.cxx
00025 //  Author : Sergey RUIN
00026 //  Module : SALOME
00027 //
00028 #include "SALOMEDS_TMPFile_i.hxx"
00029 
00030 #include <stdexcept>
00031 
00032 SALOMEDS_TMPFile_i
00033 ::SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream):
00034   myStream(theStream)
00035 {}
00036 
00037 size_t
00038 SALOMEDS_TMPFile_i
00039 ::Size()
00040 {
00041   if(!&myStream.in())
00042     return 0;
00043 
00044   return myStream->length();
00045 }
00046 
00047 SALOMEDSImpl_TMPFile::TOctet&
00048 SALOMEDS_TMPFile_i
00049 ::Get(size_t theIndex)
00050 {
00051   if(!&myStream.in())
00052     throw std::out_of_range("SALOMEDS_TMPFile_i::Get(size_t) const - !&myStream.in()");
00053 
00054   if(theIndex < 0 || theIndex >= myStream->length())
00055     throw std::out_of_range("SALOMEDS_TMPFile_i::Get(size_t) const - theIndex < 0 || theIndex >= myStream->length()");
00056 
00057   return myStream[theIndex];
00058 }
00059 
00060 
00061 //-----------------------------------------------------------------------------
00062 Engines_TMPFile_i
00063 ::Engines_TMPFile_i(Engines::TMPFile* theStream):
00064   myStream(theStream)
00065 {}
00066 
00067 size_t
00068 Engines_TMPFile_i
00069 ::Size()
00070 {
00071   if(!&myStream.in())
00072     return 0;
00073 
00074   return myStream->length();
00075 }
00076 
00077 SALOMEDSImpl_TMPFile::TOctet&
00078 Engines_TMPFile_i
00079 ::Get(size_t theIndex)
00080 {
00081   if(!&myStream.in())
00082     throw std::out_of_range("Engines_TMPFile_i::Get(size_t) const - !&myStream.in()");
00083 
00084   if(theIndex < 0 || theIndex >= myStream->length())
00085     throw std::out_of_range("Engines_TMPFile_i::Get(size_t) const - theIndex < 0 || theIndex >= myStream->length()");
00086 
00087   return myStream[theIndex];
00088 }