Ignore:
Timestamp:
07/23/13 18:15:30 (11 years ago)
Author:
sz
Message:

introducing object de/serialization - see serialtest.cpp
the core GDK classes can be now used in multiple threads (ifdef MULTITHREADED)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/gdk/multiparamload.cpp

    r81 r104  
    1919breakcond=OnError;
    2020emptyparam.setParamTab(empty_paramtab);
     21}
     22
     23int MultiParamLoader::findObject(const ExtObject &o)
     24{
     25for(int i=0;i<objects.size();i++)
     26        if ((*objects(i))==o)
     27                return i;
     28return -1;
     29}
     30
     31void MultiParamLoader::removeObject(const ExtObject &o)
     32{
     33int i=findObject(o);
     34if (i>=0)
     35        {
     36        delete objects(i);
     37        objects-=i;
     38        }
     39}
     40
     41void MultiParamLoader::clearObjects()
     42{
     43FOREACH(ExtObject*,o,objects)
     44        delete o;
     45objects.clear();
    2146}
    2247
     
    102127while (!finished())
    103128        {
    104         if ((status==BeforeObject) || ((status==BeforeUnknown)&&lastclass))
    105                 {
    106                 lastclass->load(file);
     129        if ((status==BeforeObject) || ((status==BeforeUnknown) && !lastobject.isEmpty()))
     130                {
     131                Param tmp_param;
     132                ParamInterface *pi=lastobject.getParamInterface(tmp_param);
     133                pi->load(file);
    107134                if ((status!=Finished) && maybeBreak(AfterObject))
    108135                        break;
     
    155182                lastunknown=0;
    156183                lastunknown.append(t,linlen-1);
    157                 lastclass=0;
    158                 FOREACH(ParamInterface*,pi,params)
    159                         {
    160                         if (!strcmp(pi->getName(),lastunknown)) { lastclass=pi; break; }
    161                         }
    162                         if (lastclass)
     184                lastobject.setEmpty();
     185                FOREACH(ExtObject*,o,objects)
     186                        {
     187                        if (!strcmp(o->interfaceName(),lastunknown)) {lastobject=*o; break;}
     188                        }
     189                        if (!lastobject.isEmpty())
    163190                                {
    164191                                if (maybeBreak(BeforeObject))
     
    244271}
    245272
    246 int MultiParamLoader::loadObjectNow(ParamInterface *pi)
    247 {
     273int MultiParamLoader::loadObjectNow(const ExtObject& o)
     274{
     275Param tmp_param;
     276ParamInterface *pi=o.getParamInterface(tmp_param);
    248277pi->load(file);
    249278status=AfterObject;
Note: See TracChangeset for help on using the changeset viewer.