// ---------------------------------------------------------------------------- // multicnt.cc // begin of file // Stephan Endrass, endrass@mathematik.uni-mainz.de // 23.7.99 // ---------------------------------------------------------------------------- #define MULTICNT_CC #ifdef HAVE_CONFIG_H #include "singularconfig.h" #endif /* HAVE_CONFIG_H */ #include #ifdef HAVE_SPECTRUM #include #ifdef MULTICNT_PRINT #include #ifndef MULTICNT_IOSTREAM #include #endif #endif #include // ---------------------------------------------------------------------------- // allocate counter memory // ---------------------------------------------------------------------------- void multiCnt::copy_new( int n ) { if( n > 0 ) { cnt = new int[n]; #ifndef NDEBUG if( cnt == (int*)NULL ) { #ifdef MULTICNT_PRINT #ifdef MULTICNT_IOSTREAM cerr << "multiCnt::copy_new(" << n << ")" << endl; cerr << " returned ZERO!!!" << endl; cerr << " exit..." << endl; #else fprintf( stderr,"multiCnt::copy_new( %d )\n",n ); fprintf( stderr," returned ZERO!!!\n" ); fprintf( stderr," exit...\n" ); #endif #endif exit( 1 ); } #endif } else if( n == 0 ) { cnt = (int*)NULL; } else { #ifdef MULTICNT_PRINT #ifdef MULTICNT_IOSTREAM cerr << "multiCnt::copy_new(" << n << ")" << endl; cerr << " exit..." << endl; #else fprintf( stderr,"multiCnt::copy_new( %d )\n",n ); fprintf( stderr," exit...\n" ); #endif #endif exit( 1 ); } } // ---------------------------------------------------------------------------- // delete counter memory // ---------------------------------------------------------------------------- void multiCnt::copy_delete( void ) { if( N>0 && cnt!=(int*)NULL ) delete [] cnt; copy_zero( ); } // ---------------------------------------------------------------------------- // copy a counter // ---------------------------------------------------------------------------- void multiCnt::copy_deep( const multiCnt &C ) { copy_new( C.N ); last_inc = C.last_inc; N = C.N; for( int i=0; i