LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/ili/iom - iom_object.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 303 1 0.3 %
Date: 2011-12-18 Functions: 76 2 2.6 %

       1                 : /**********************************************************************
       2                 :  * $Id: iom_object.cpp 12582 2007-10-29 09:38:21Z pka $
       3                 :  *
       4                 :  * Project:  iom - The INTERLIS Object Model
       5                 :  * Purpose:  For more information, please see <http://iom.sourceforge.net>
       6                 :  * Author:   Claude Eisenhut
       7                 :  *
       8                 :  **********************************************************************
       9                 :  * Copyright (c) 2007, Claude Eisenhut
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  * 
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  * 
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      22                 :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : 
      31                 : /** @file
      32                 :  * implementation of object object
      33                 :  * @defgroup object object level functions
      34                 :  * @{
      35                 :  */
      36                 : 
      37                 : #include <assert.h>
      38                 : #include <iom/iom_p.h>
      39                 : 
      40                 : /**
      41                 :  * release handle
      42                 :  */
      43               0 : extern "C" int iom_releaseobject(IOM_OBJECT object)
      44                 : {
      45               0 :   if(!object->freeRef()){
      46               0 :     delete object;
      47                 :   }
      48               0 :   return 0;
      49                 : }
      50                 : 
      51                 : // Objekt löschen
      52                 : extern "C" int iom_deleteobject(IOM_OBJECT object);
      53                 : 
      54                 : 
      55                 : /** gets the tag of this object.
      56                 :  * The return value is valid until iom_close or iom_setclass.
      57                 :  */
      58               0 : extern "C" IOM_TAG iom_getobjecttag(IOM_OBJECT object)
      59                 : {
      60               0 :   return object->getTag_c();
      61                 : }
      62                 : 
      63                 : /** sets the tag of this object.
      64                 :  */
      65               0 : extern "C" void iom_setobjecttag(IOM_OBJECT object,IOM_TAG tag)
      66                 : {
      67               0 :   object->setTag(ParserHandler::getTagId(tag));
      68               0 : }
      69                 : 
      70                 : /** gets the OID of this object.
      71                 :  * The return value is valid until iom_close or iom_setobjectoid.
      72                 :  */
      73               0 : extern "C" IOM_OID iom_getobjectoid(IOM_OBJECT object){
      74               0 :   return object->getOid_c();
      75                 : }
      76                 : 
      77                 : /** sets the OID of this object.
      78                 :  */
      79               0 : extern "C" void iom_setobjectoid(IOM_OBJECT object,IOM_OID oid)
      80                 : {
      81               0 :   object->setOid(X(oid));
      82               0 : }
      83                 : 
      84                 : /** get xmlfile line number of a object.
      85                 :  */
      86               0 : extern "C" int iom_getobjectline(IOM_OBJECT obj)
      87                 : {
      88               0 :   return obj->getXMLLineNumber();
      89                 : }
      90                 : 
      91                 : /** get xmlfile column number of a object.
      92                 :  */
      93               0 : extern "C" int iom_getobjectcol(IOM_OBJECT obj)
      94                 : {
      95               0 :   return obj->getXMLColumnNumber();
      96                 : }
      97                 : 
      98                 : /** gets the oid of the referenced object or 0 if this is not a reference.
      99                 :  */
     100               0 : extern "C" IOM_OID iom_getobjectrefoid(IOM_OBJECT object){
     101               0 :   return object->getRefOid_c();
     102                 : }
     103                 : 
     104                 : /** sets the oid of the referenced object.
     105                 :  */
     106               0 : extern "C" void iom_setobjectrefoid(IOM_OBJECT object,IOM_OID refoid)
     107                 : {
     108               0 :   object->setRefOid(X(refoid));
     109               0 : }
     110                 : 
     111                 : /** get the bid of the referenced object or 0 if this is not a reference
     112                 :  *  or returns 0 if the referenced object is in the same basket.
     113                 :  */
     114               0 : extern "C" IOM_OID iom_getobjectrefbid(IOM_OBJECT object){
     115               0 :   return object->getRefBid_c();
     116                 : }
     117                 : 
     118                 : /** sets the bid of the referenced object.
     119                 :  */
     120               0 : extern "C" void iom_setobjectrefbid(IOM_OBJECT object,IOM_OID refbid)
     121                 : {
     122               0 :   object->setRefBid(X(refbid));
     123               0 : }
     124                 : 
     125                 : /** gets the ORDER_POS of the referenced object.
     126                 : */
     127               0 : extern "C" unsigned int iom_getobjectreforderpos(IOM_OBJECT object)
     128                 : {
     129               0 :   return object->getRefOrderPos();
     130                 : }
     131                 : 
     132                 : /** sets the ORDER_POS of the referenced object.
     133                 : */
     134               0 : extern "C" void iom_setobjectreforderpos(IOM_OBJECT object,unsigned int orderPos)
     135                 : {
     136               0 :   object->setRefOrderPos(orderPos);
     137               0 : }
     138                 : 
     139                 : /** gets the operation-mode of an object.
     140                 :  */
     141               0 : extern "C" int iom_getobjectoperation(IOM_OBJECT object){
     142               0 :   return object->getOperation();
     143                 : }
     144                 : 
     145                 : /** sets the operation-mode of an object.
     146                 :  */
     147               0 : extern "C" void iom_setobjectoperation(IOM_OBJECT object,int operation){
     148               0 :   object->setOperation(operation);
     149               0 : }
     150                 : 
     151                 : /** gets the consistency of an object.
     152                 :  */
     153               0 : extern "C" int iom_getobjectconsistency(IOM_OBJECT object){
     154               0 :   return object->getConsistency();
     155                 : }
     156                 : 
     157                 : /** sets the consistency of an object.
     158                 :  */
     159               0 : extern "C" void iom_setobjectconsistency(IOM_OBJECT object,int consistency){
     160               0 :   object->setConsistency(consistency);
     161               0 : }
     162                 : 
     163                 : /** @}
     164                 :  */
     165                 : 
     166               0 : iom_object::iom_object()
     167                 :   :useCount(0)
     168                 :   , basket(0)
     169                 :   ,consistency(IOM_COMPLETE)
     170                 :   ,operation(IOM_OP_INSERT)
     171                 :   ,tag(0)
     172                 :   ,tag_c(0)
     173                 :   ,xmlLine(0)
     174                 :   ,xmlCol(0)
     175                 :   ,oid_w(0)
     176                 :   ,oid_c(0)
     177                 :   ,bid_w(0)
     178                 :   ,bid_c(0)
     179                 :   ,refOid_w(0)
     180                 :   ,refOid_c(0)
     181                 :   ,refBid_w(0)
     182                 :   ,refBid_c(0)
     183               0 :   , refOrderPos(0)
     184                 : {
     185               0 : }
     186               0 : iom_object::~iom_object()
     187                 : {
     188               0 :   if(tag_c)XMLString::release(&tag_c);
     189               0 :   if(oid_c)XMLString::release(&oid_c);
     190               0 :   if(oid_w)XMLString::release(&oid_w);
     191               0 :   if(bid_c)XMLString::release(&bid_c);
     192               0 :   if(bid_w)XMLString::release(&bid_w);
     193               0 :   if(refOid_w)XMLString::release(&refOid_w);
     194               0 :   if(refOid_c)XMLString::release(&refOid_c);
     195               0 :   if(refBid_w)XMLString::release(&refBid_w);
     196               0 :   if(refBid_c)XMLString::release(&refBid_c);
     197               0 : }
     198                 : 
     199               0 : void iom_object::setBasket(IomBasket basket1)
     200                 : {
     201               0 :   basket=&(*basket1);
     202               0 :   assert(tag!=0);
     203               0 : }
     204                 : 
     205               0 : void iom_object::setTag(int tag1)
     206                 : {
     207               0 :   if(tag_c){
     208               0 :     XMLString::release(&tag_c);
     209               0 :     tag_c=0;
     210                 :   }
     211               0 :   tag=tag1;
     212               0 :   const XMLCh *const tag_w=ParserHandler::getTagName(tag);
     213               0 :   tag_c=XMLString::transcode(tag_w);
     214               0 : }
     215               0 : const char *iom_object::getTag_c()
     216                 : {
     217               0 :   if(!tag){
     218               0 :     return 0;
     219                 :   }
     220               0 :   if(!tag_c){
     221               0 :     const XMLCh *const tag_w=ParserHandler::getTagName(tag);
     222               0 :     tag_c=XMLString::transcode(tag_w);
     223                 :   }
     224               0 :   return tag_c;
     225                 : }
     226               0 : int iom_object::getTag()
     227                 : {
     228               0 :   return tag;
     229                 : }
     230                 : 
     231               0 : void iom_object::setXMLLineNumber(int line)
     232                 : {
     233               0 :   xmlLine=line;
     234               0 : }
     235                 : 
     236               0 : int iom_object::getXMLLineNumber()
     237                 : {
     238               0 :   return xmlLine;
     239                 : }
     240                 : 
     241               0 : void iom_object::setXMLColumnNumber(int col)
     242                 : {
     243               0 :   xmlCol=col;
     244               0 : }
     245                 : 
     246               0 : int iom_object::getXMLColumnNumber()
     247                 : {
     248               0 :   return xmlCol;
     249                 : }
     250                 : 
     251                 : /** sets the consistency of an object.
     252                 :  */
     253               0 : void iom_object::setConsistency(int cons)
     254                 : {
     255               0 :   consistency=cons;
     256               0 : }
     257                 : 
     258                 : /** gets the consistency of an object.
     259                 :  */
     260               0 : int iom_object::getConsistency()
     261                 : {
     262               0 :   return consistency;
     263                 : }
     264                 : 
     265                 : /** sets the operation-mode of an object.
     266                 :  */
     267               0 : void iom_object::setOperation(int op)
     268                 : {
     269               0 :   operation=op;
     270               0 : }
     271                 : 
     272                 : /** gets the operation-mode of an object.
     273                 :  */
     274               0 : int iom_object::getOperation()
     275                 : {
     276               0 :   return operation;
     277                 : }
     278                 : 
     279               0 : void iom_object::setOid(const XMLCh *oid)
     280                 : {
     281               0 :   if(oid_c)XMLString::release(&oid_c);
     282               0 :   if(oid_w)XMLString::release(&oid_w);
     283               0 :   oid_w=XMLString::replicate(oid);
     284               0 : }
     285               0 : const XMLCh *iom_object::getOid()
     286                 : {
     287               0 :   return oid_w;
     288                 : }
     289               0 : const char *iom_object::getOid_c()
     290                 : {
     291               0 :   if(!oid_w){
     292               0 :     return 0;
     293                 :   }
     294               0 :   if(!oid_c){
     295               0 :     oid_c=XMLString::transcode(oid_w);
     296                 :   }
     297               0 :   return oid_c;
     298                 : }
     299                 : 
     300               0 : void iom_object::setBid(const XMLCh *bid)
     301                 : {
     302               0 :   if(bid_c)XMLString::release(&bid_c);
     303               0 :   if(bid_w)XMLString::release(&bid_w);
     304               0 :   bid_w=XMLString::replicate(bid);
     305               0 : }
     306               0 : const char *iom_object::getBid_c()
     307                 : {
     308               0 :   if(!bid_w){
     309               0 :     return 0;
     310                 :   }
     311               0 :   if(!bid_c){
     312               0 :     bid_c=XMLString::transcode(bid_w);
     313                 :   }
     314               0 :   return bid_c;
     315                 : }
     316               0 : const XMLCh* iom_object::getBid()
     317                 : {
     318               0 :   return bid_w;
     319                 : }
     320                 : 
     321                 : /** sets the oid of the referenced object.
     322                 :  */
     323               0 : void iom_object::setRefOid(const XMLCh *oid)
     324                 : {
     325               0 :   if(refOid_c)XMLString::release(&refOid_c);
     326               0 :   if(refOid_w)XMLString::release(&refOid_w);
     327               0 :   refOid_w=XMLString::replicate(oid);
     328               0 : }
     329                 : 
     330                 : /** gets the oid of the referenced object.
     331                 :  */
     332               0 : const char *iom_object::getRefOid_c()
     333                 : {
     334               0 :   if(!refOid_w){
     335               0 :     return 0;
     336                 :   }
     337               0 :   if(!refOid_c){
     338               0 :     refOid_c=XMLString::transcode(refOid_w);
     339                 :   }
     340               0 :   return refOid_c;
     341                 : }
     342                 : 
     343                 : /** gets the oid of the referenced object.
     344                 :  */
     345               0 : const XMLCh *iom_object::getRefOid()
     346                 : {
     347               0 :   return refOid_w;
     348                 : }
     349                 : 
     350                 : /** sets the bid of the referenced object.
     351                 :  */
     352               0 : void iom_object::setRefBid(const XMLCh *bid)
     353                 : {
     354               0 :   if(refBid_c)XMLString::release(&refBid_c);
     355               0 :   if(refBid_w)XMLString::release(&refBid_w);
     356               0 :   refBid_w=XMLString::replicate(bid);
     357               0 : }
     358                 : 
     359                 : 
     360                 : /** gets the bid of the referenced object.
     361                 :  */
     362               0 : const char *iom_object::getRefBid_c()
     363                 : {
     364               0 :   if(!refBid_w){
     365               0 :     return 0;
     366                 :   }
     367               0 :   if(!refBid_c){
     368               0 :     refBid_c=XMLString::transcode(refBid_w);
     369                 :   }
     370               0 :   return refBid_c;
     371                 : }
     372                 : 
     373                 : /** gets the bid of the referenced object.
     374                 :  */
     375               0 : const XMLCh *iom_object::getRefBid()
     376                 : {
     377               0 :   return refBid_w;
     378                 : }
     379                 : 
     380                 : /** gets ORDER_POS value, if this is a ORDERED association end.
     381                 :  */
     382               0 : unsigned int iom_object::getRefOrderPos()
     383                 : {
     384               0 :   return refOrderPos;
     385                 : }
     386                 : 
     387                 : /** sets ORDER_POS value, if this is a ORDERED association end.
     388                 :  */
     389               0 : void iom_object::setRefOrderPos(unsigned int value)
     390                 : {
     391               0 :   refOrderPos=value;
     392               0 : }
     393                 : 
     394                 : /** dumps all attributes to stderr.
     395                 :  */
     396               0 : void iom_object::dumpAttrs(){
     397                 : 
     398               0 :   attrValuev_type::iterator attr=attrValuev.begin();
     399               0 :   while(attr!=attrValuev.end()){
     400               0 :     std::cerr << attr->first << ", " << StrX(ParserHandler::getTagName(attr->first)) << std::endl;
     401               0 :     attr++;
     402                 :   }
     403               0 : }
     404                 : 
     405                 : /** sets the value of a primitive type attribute.
     406                 :  */
     407               0 : void iom_object::parser_addAttrValue(int attrName,const XMLCh *value)
     408                 : {
     409               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     410                 :   int idx;
     411               0 :   if(attr==attrValuev.end()){
     412                 :     // not found, add
     413               0 :     valuev_type valuev;
     414               0 :     idx=valuev.size();
     415               0 :     valuev.push_back(iom_value(XMLString::replicate(value)));
     416               0 :     attrValuev[attrName]=valuev;
     417                 :   }else{
     418                 :     // found, add
     419               0 :     valuev_type valuev=attr->second;
     420               0 :     idx=valuev.size();
     421               0 :     valuev.push_back(iom_value(XMLString::replicate(value)));
     422               0 :     attrValuev[attrName]=valuev;
     423                 :   }
     424               0 :   xmleleidxv.push_back(xmlele_type(attrName,idx));
     425               0 : }
     426               0 : void iom_object::parser_addAttrValue(int attrName,IomObject value)
     427                 : {
     428               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     429                 :   int idx;
     430               0 :   if(attr==attrValuev.end()){
     431                 :     // not found, add
     432               0 :     valuev_type valuev;
     433               0 :     idx=valuev.size();
     434               0 :     valuev.push_back(iom_value(value));
     435               0 :     attrValuev[attrName]=valuev;
     436                 :   }else{
     437                 :     // found, add
     438               0 :     valuev_type valuev=attr->second;
     439               0 :     idx=valuev.size();
     440               0 :     valuev.push_back(iom_value(value));
     441               0 :     attrValuev[attrName]=valuev;
     442                 :   }
     443               0 :   xmleleidxv.push_back(xmlele_type(attrName,idx));
     444               0 : }
     445                 : 
     446               0 : int iom_object::getXmleleCount()
     447                 : {
     448               0 :   return xmleleidxv.size();
     449                 : }
     450                 : 
     451               0 : int iom_object::getXmleleAttrName(int index)
     452                 : {
     453               0 :   return xmleleidxv.at(index).first;
     454                 : }
     455                 : 
     456               0 : int iom_object::getXmleleValueIdx(int index)
     457                 : {
     458               0 :   return xmleleidxv.at(index).second;
     459                 : }
     460                 : 
     461                 : /** sets the value of an attribute to undefined. 
     462                 :  */
     463               0 : void iom_object::setAttrUndefined(int attrName)
     464                 : {
     465               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     466               0 :   if(attr==attrValuev.end()){
     467                 :     // not found
     468                 :   }else{
     469                 :     // found, remove
     470               0 :     attrValuev.erase(attr); // TODO free strings
     471                 :   }
     472               0 : }
     473                 : 
     474                 : /** sets the value of a primitive type attribute. 
     475                 :  *  If value==0, the attribute is set to undefined.
     476                 :  */
     477               0 : void iom_object::setAttrValue(int attrName,const XMLCh *value)
     478                 : {
     479                 :   
     480               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     481               0 :   if(attr==attrValuev.end()){
     482                 :     // not found, add
     483               0 :     if(value){
     484               0 :       valuev_type valuev;
     485               0 :       valuev.push_back(iom_value(XMLString::replicate(value)));
     486               0 :       attrValuev[attrName]=valuev;
     487                 :     }
     488                 :   }else{
     489                 :     // found, replace
     490               0 :     if(value){
     491               0 :       valuev_type valuev=attr->second;
     492               0 :       valuev.clear(); // TODO free strings
     493               0 :       valuev.push_back(iom_value(XMLString::replicate(value)));
     494               0 :       attrValuev[attrName]=valuev;
     495                 :     }else{
     496               0 :       attrValuev.erase(attr); // TODO free strings
     497                 :     }
     498                 :   }
     499               0 : }
     500                 : 
     501                 : /** gets the value of a primitive type attribute.
     502                 :  */
     503               0 : const XMLCh *iom_object::getAttrValue(int attrName)
     504                 : {
     505               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     506               0 :   if(attr==attrValuev.end()){
     507                 :     // not found
     508               0 :     return 0;
     509                 :   }
     510                 :   // found
     511               0 :   valuev_type valuev=attr->second;
     512               0 :   iom_value value=valuev.at(0);
     513               0 :   return value.getStr();
     514                 : }
     515                 : 
     516               0 : int iom_object::getAttrCount()
     517                 : {
     518               0 :   return attrValuev.size();
     519                 : }
     520                 : 
     521               0 : int iom_object::getAttrName(int index)
     522                 : {
     523               0 :   attrValuev_type::iterator attri=attrValuev.begin();
     524               0 :   int i=0;
     525               0 :   while(attri!=attrValuev.end() && i<=index){
     526               0 :     if(i==index){
     527               0 :       return attri->first;
     528                 :     }
     529               0 :     attri++;
     530               0 :     i++;
     531                 :   }
     532               0 :   return 0;
     533                 : }
     534                 : 
     535               0 : int iom_object::getAttrValueCount(int attrName)
     536                 : {
     537               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     538               0 :   if(attr==attrValuev.end()){
     539                 :     // not found
     540               0 :     return 0;
     541                 :   }
     542                 :   // found
     543               0 :   valuev_type valuev=attr->second;
     544               0 :   return valuev.size();
     545                 : }
     546                 : 
     547               0 : const XMLCh *iom_object::getAttrPrim(int attrName,int index)
     548                 : {
     549               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     550               0 :   if(attr==attrValuev.end()){
     551                 :     // not found
     552               0 :     return 0;
     553                 :   }
     554                 :   // found
     555               0 :   valuev_type valuev=attr->second;
     556               0 :   iom_value value=valuev.at(index);
     557               0 :   return value.getStr();
     558                 : }
     559                 : 
     560                 : /** get value at given index.
     561                 :  */
     562               0 : IomObject iom_object::getAttrObj(int attrName,int index)
     563                 : {
     564               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     565               0 :   if(attr==attrValuev.end()){
     566                 :     // not found
     567               0 :     return 0;
     568                 :   }
     569                 :   // found
     570               0 :   valuev_type valuev=attr->second;
     571               0 :   iom_value value=valuev.at(index);
     572               0 :   return value.getObj();
     573                 : }
     574                 : 
     575                 : /** change value at given index
     576                 : */
     577               0 : void iom_object::setAttrObj(int attrName,int index,IomObject value)
     578                 : {
     579               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     580               0 :   if(attr==attrValuev.end()){
     581                 :     // not found, add
     582               0 :     valuev_type valuev;
     583               0 :     valuev.push_back(iom_value(value));
     584               0 :     attrValuev[attrName]=valuev;
     585                 :   }else{
     586                 :     // found, replace
     587               0 :     valuev_type valuev=attr->second;
     588               0 :     valuev.at(index)=iom_value(value);
     589               0 :     attrValuev[attrName]=valuev;
     590                 :   }
     591               0 : }
     592                 : 
     593                 : /** insert value a given index.
     594                 : */
     595               0 : void iom_object::insertAttrObj(int attrName,int index,IomObject value)
     596                 : {
     597               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     598               0 :   if(attr==attrValuev.end()){
     599                 :     // not found, add
     600               0 :     valuev_type valuev;
     601               0 :     valuev.push_back(iom_value(value));
     602               0 :     attrValuev[attrName]=valuev;
     603                 :   }else{
     604                 :     // found, add
     605               0 :     valuev_type valuev=attr->second;
     606               0 :     valuev.insert(valuev.begin()+index,iom_value(value));
     607               0 :     attrValuev[attrName]=valuev;
     608                 :   }
     609               0 : }
     610                 : 
     611                 : /** add value to end of list.
     612                 : */
     613               0 : void iom_object::addAttrObj(int attrName,IomObject value)
     614                 : {
     615               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     616               0 :   if(attr==attrValuev.end()){
     617                 :     // not found, add
     618               0 :     valuev_type valuev;
     619               0 :     valuev.push_back(iom_value(value));
     620               0 :     attrValuev[attrName]=valuev;
     621                 :   }else{
     622                 :     // found, add
     623               0 :     valuev_type valuev=attr->second;
     624               0 :     valuev.push_back(iom_value(value));
     625               0 :     attrValuev[attrName]=valuev;
     626                 :   }
     627               0 : }
     628                 : 
     629                 : /** remove value with given index
     630                 : */
     631               0 : void iom_object::removeAttrObj(int attrName,int index)
     632                 : {
     633               0 :   attrValuev_type::iterator attr=attrValuev.find(attrName);
     634               0 :   if(attr==attrValuev.end()){
     635                 :     // not found
     636                 :   }else{
     637                 :     // found, remove
     638               0 :     valuev_type valuev=attr->second;
     639               0 :     valuev.erase(valuev.begin()+index);
     640               0 :     attrValuev[attrName]=valuev;
     641                 :   }
     642               0 : }
     643                 : 
     644               0 : IomObject::IomObject(struct iom_object *pointee1) 
     645               0 : : pointee(pointee1 ? pointee1->getRef() : 0){
     646               0 : }
     647               0 : IomObject::IomObject(const IomObject& src) 
     648               0 : : pointee(src.pointee ? src.pointee->getRef() : 0){
     649               0 : }
     650               0 : IomObject& IomObject::operator=(const IomObject& src){
     651               0 :   if(this!=&src){
     652               0 :     if(pointee && !pointee->freeRef()){
     653               0 :       delete pointee;
     654                 :     }
     655               0 :     pointee=src.pointee ? src.pointee->getRef() : 0;
     656                 :   }
     657               0 :   return *this;
     658                 : }
     659               0 : IomObject::~IomObject(){
     660               0 :   if(pointee && !pointee->freeRef()){
     661               0 :     delete pointee;
     662                 :   }
     663            1947 : }
     664                 : 

Generated by: LCOV version 1.7