Logo Search packages:      
Sourcecode: djvulibre version File versions

void DataPool::connect ( const GP< DataPool > &  master_pool,
int  start = 0,
int  length = -1 
)

Switches the DataPool# to slave mode and connects it to the specified offsets range of the master DataPool#.

Parameters:
master_pool Master DataPool# providing data for this slave
start Beginning of the offsets range which the slave is mapped into
length Length of the offsets range. If negative, the range is assumed to extend up to the end of the master DataPool#.

Definition at line 867 of file DataPool.cpp.

References GURL::is_local_file_url().

Referenced by create().

{
   DEBUG_MSG("DataPool::connect(): connecting to another DataPool\n");
   DEBUG_MAKE_INDENT(3);
   
   if (pool) G_THROW( ERR_MSG("DataPool.connected1") );
   if (furl.is_local_file_url()) G_THROW( ERR_MSG("DataPool.connected2") );
   if (start_in<0) G_THROW( ERR_MSG("DataPool.neg_start") );

   pool=pool_in;
   start=start_in;
   length=length_in;

      // The following will work for length<0 too
   if (pool->has_data(start, length))
     eof_flag=true;
   else
     pool->add_trigger(start, length, static_trigger_cb, this);

   data=0;

   wake_up_all_readers();
   
      // Pass registered trigger callbacks to the DataPool
   GCriticalSectionLock lock(&triggers_lock);
   for(GPosition pos=triggers_list;pos;++pos)
   {
      GP<Trigger> t=triggers_list[pos];
      int tlength=t->length;
      if (tlength<0 && length>0)
        tlength=length-t->start;
      pool->add_trigger(start+t->start, tlength, t->callback, t->cl_data);
   }
}


Generated by  Doxygen 1.6.0   Back to index