Esempio n. 1
0
int Container::isEqual( const Object& testContainer ) const
{
    PRECONDITION( isA() == testContainer.isA() );

    int res = 1;

    ContainerIterator& thisIterator = initIterator();
    ContainerIterator& testContainerIterator =
                            ((Container &)(testContainer)).initIterator();
    while( thisIterator != 0 && testContainerIterator != 0 )
        {
        if( thisIterator++ != testContainerIterator++ )
            {
            res = 0;
            break;
            }
        }

    if( thisIterator != 0 || testContainerIterator != 0 )
        res = 0;

    delete &testContainerIterator;
    delete &thisIterator;
    return res;
}
int AbstractArray::isEqual( const Object& obj ) const
{
    PRECONDITION( isA() == obj.isA() );
    AbstractArray& test = (AbstractArray&)obj;
    if( lowerBound() != test.lowerBound() ||
        upperBound() != test.upperBound()
      )
        return 0;

    ContainerIterator& iter1 = initIterator();
    ContainerIterator& iter2 = test.initIterator();
    while( iter1 && iter2 )
        if( iter1.current() != iter2.current() )
            {
            delete &iter1;
            delete &iter2;
            return 0;
            }
        else
            {
            iter1++;
            iter2++;
            }

    delete &iter1;
    delete &iter2;
    return 1;
}
Esempio n. 3
0
void Container::forEach( iterFuncType actionPtr, void *paramListPtr )
{
    PRECONDITION( actionPtr != 0 );
    ContainerIterator& containerIterator = initIterator();
    while( containerIterator != 0 )
        containerIterator++.forEach( actionPtr, paramListPtr );
    delete &containerIterator;
}
Esempio n. 4
0
	OperandIterator::OperandIterator( const OperandIterator& src )
		: coll_( src.coll_ )
	{
		coll_.ref();

		// We init a new iterator so the copy is independent
		initIterator();
	}
Esempio n. 5
0
// Internal method to iterate over all parameters, calling a method callback on each one.
// This is generally less useful than the iterator methods.
void Parameters::iterateAll( void (Parameters::*callback)(struct parameter_descriptor_t *) )
{
  struct Parameters::iterator_t iterator;
  initIterator(&iterator);
  struct parameter_descriptor_t *desc = nextParameter(&iterator);

  while (desc) {
    (this->*callback)( desc );
    desc = nextParameter(&iterator);
  }
}
Esempio n. 6
0
// Internal function to find a named parameter in an array of descriptors.
// Returns the pointer to the descriptor or NULL.
struct parameter_descriptor_t *Parameters::find( const char *name )
{
  struct Parameters::iterator_t iterator;
  initIterator(&iterator);
  struct parameter_descriptor_t *desc = nextParameter(&iterator);

  while (desc) {
    if ( !strcmp(name, desc->name)) return desc;
    desc = nextParameter(&iterator);
  }
  return NULL;
}
Esempio n. 7
0
/**
	vectorize quantified values
*/
void vectorize(int quantizeData[BLOCK_SIZE*BLOCK_SIZE], int data[BLOCK_SIZE*BLOCK_SIZE]){

    Iterator iter;
    int i = 0;

    initIterator(&iter);
    do{
        data[i] = quantizeData[iter.i*BLOCK_SIZE+iter.j];        
        blocIteratorNext(&iter);
        i++;
    }while(iteratorHasNext(iter));
}
Esempio n. 8
0
void Parameters::forEachMatching( void (*f)(const char *name, int value), const char *name )
{
  if (name != NULL) {
    int namelen = strlen(name);
    struct Parameters::iterator_t iterator;
    initIterator(&iterator);
    struct parameter_descriptor_t *desc = nextParameter(&iterator);
    while (desc) {
      if ( !strncmp(name, desc->name, namelen)) {
	f( desc->name, *(desc->value));
      }
      desc = nextParameter(&iterator);
    }
  }
}
Esempio n. 9
0
void Container::printOn( ostream& outputStream ) const
{
    ContainerIterator& printIterator = initIterator();
    printHeader( outputStream );
    while( printIterator != 0 )
        {
        printIterator++.printOn( outputStream );
        if ( printIterator != 0 )
            printSeparator( outputStream );
        else
            break;
        }
    printTrailer( outputStream );
    delete &printIterator;
}
Esempio n. 10
0
Object _FAR & Collection::findMember( Object _FAR & testObject ) const
{
    ContainerIterator& containerIterator = initIterator();
    while( containerIterator != 0 )
        {
        Object& listObject = containerIterator++;
        if( listObject == testObject )
            {
            delete &containerIterator;
            return listObject;
            }
        }
    delete &containerIterator;
    return NOOBJECT;
}
Esempio n. 11
0
void Parameters::setFirstMatching( const char *name, int value )
{
  if (name != NULL) {
    int namelen = strlen(name);
    struct Parameters::iterator_t iterator;
    initIterator(&iterator);
    struct parameter_descriptor_t *desc = nextParameter(&iterator);
    while (desc) {
      if ( !strncmp(name, desc->name, namelen)) {
	*(desc->value) = value;
	return;
      }
      desc = nextParameter(&iterator);
    }
  }
}
Esempio n. 12
0
Object& Container::lastThat( condFuncType testFuncPtr,
                             void *paramListPtr
                           ) const
{
    PRECONDITION( testFuncPtr != 0 );
    ContainerIterator& containerIterator = initIterator();
    Object *lastMet = ZERO;
    while( containerIterator != 0 )
        {
        Object& testResult =
                containerIterator++.lastThat( testFuncPtr, paramListPtr );
        if( testResult != NOOBJECT )
            lastMet = &testResult;
        }
    delete &containerIterator;
    return *lastMet;
}
Esempio n. 13
0
Object& Container::firstThat( condFuncType testFuncPtr,
                              void *paramListPtr
                            ) const
{
    PRECONDITION( testFuncPtr != 0 );
    ContainerIterator &containerIterator = initIterator();
    while( containerIterator != 0 )
        {
        Object& testResult =
                containerIterator++.firstThat( testFuncPtr, paramListPtr );
        if ( testResult != NOOBJECT )
            {
            delete &containerIterator;
            return testResult;
            }
        }
    delete &containerIterator;
    return NOOBJECT;
}
void AbstractArray::printContentsOn( ostream& outputStream ) const
{
    ContainerIterator& printIterator = initIterator();
    printHeader( outputStream );
    while( printIterator != 0 )
        {
        Object& arrayObject = printIterator++;
        if( arrayObject != NOOBJECT )
            {
            arrayObject.printOn( outputStream );
            if( printIterator != 0 )
                printSeparator( outputStream );
            else
                break;
            }
        }
    printTrailer( outputStream );
    delete &printIterator;
}
Esempio n. 15
0
	bool TrickHelper::haveGroup( CardGroup group )
	{
		IterData iterData;
		return initIterator( group , iterData );
	}
Esempio n. 16
0
	OperandIterator::OperandIterator( Coll& coll )
		: coll_( coll )
	{
		coll_.ref();
		initIterator();
	}
Esempio n. 17
0
EntityManager::EntityManager()
{
	initIterator();
	mItems = 0;
}
Esempio n. 18
0
	OperandIterator::OperandIterator( const Coll& coll )
		: coll_( const_cast< Coll& >( coll ) )
	{
		coll_.ref();
		initIterator();
	}