Example #1
0
dark_style::dark_style( void )
{
	_default_font = application::current()->get_font( "Lucida Grande", "Regular", 7.0 );
	postcondition( bool(_default_font), "font for dark style not found" );

	_default_bold_font = application::current()->get_font( "Lucida Grande", "Bold", 7.0 );
	postcondition( bool(_default_bold_font), "font for dark bold style not found" );
}
Example #2
0
void DrawPort::addConnectionPoint(RelativePosition *point)
{
  precondition(!point->hasAnchor());

  point->replaceAnchor(&this->getPosition());

  postcondition(point->hasAnchor());
  postcondition(point->getAnchor() == &this->getPosition());
}
Example #3
0
void rehash_empty_test1(X* = 0)
{
    X x;

    x.rehash(10000);
    BOOST_TEST(postcondition(x, 10000));

    x.rehash(0);
    BOOST_TEST(postcondition(x, 0));
}
Example #4
0
Component *ComponentFactory::produce(const std::string &name, const std::vector<std::string> &inPort, const std::vector<std::string> &outPort)
{
  Component *comp = produce(name);
  addPorts(comp, inPort, PortType::Slot);
  addPorts(comp, outPort, PortType::Signal);

  postcondition(comp != nullptr);
  postcondition(comp->getPorts().size() == inPort.size() + outPort.size());
  return comp;
}
Example #5
0
void ComponentFactory::cleanup(IComponent &icomponent)
{
  Component &component = *dynamic_cast<Component*>(&icomponent);  //TODO make it clean

  ImplementationFactory::dispose(component.implementation);
  component.implementation = nullptr;

  component.getPorts().clear();

  postcondition(component.getPorts().empty());
  postcondition(component.getImplementation() == nullptr);
}
Example #6
0
void
node::remove_output( node_id o )
{
	if ( _output_count > 1 )
	{
		node_id *beginOuts = _edges + _input_count;
		node_id *outs = beginOuts;
		node_id *endOuts = outs + _output_count;
		while ( outs != endOuts )
		{
			if ( (*outs) == o )
				break;
			++outs;
		}
//		std::cout << this << ": searching for node " << o << " found index " << (outs-beginOuts) << std::endl;
		postcondition( outs != endOuts, "node id {0} not an output of this node", o );
		std::rotate( outs, outs + 1, endOuts );
		--_output_count;
	}
	else if ( _output_count == 1 )
	{
		precondition( output( 0 ) == o, "node id {0} not an output of this node", o );
		_output_count = 0;
	}
}
Example #7
0
void rehash_empty_test3(X* = 0,
    test::random_generator generator = test::default_generator)
{
    test::random_values<X> v(1000, generator);
    test::ordered<X> tracker;

    X x;

    x.rehash(0);
    BOOST_TEST(postcondition(x, 0));

    tracker.insert_range(v.begin(), v.end());
    x.insert(v.begin(), v.end());
    tracker.compare(x);

    BOOST_TEST(postcondition(x, 0));
}
void rehash_test1(X* = 0, test::random_generator generator = test::default_generator)
{
    test::random_values<X> v(1000, generator);
    test::ordered<X> tracker;
    tracker.insert_range(v.begin(), v.end());
    X x(v.begin(), v.end());

    x.rehash(0); BOOST_TEST(postcondition(x, 0));
    tracker.compare(x);

    x.max_load_factor(0.25);
    x.rehash(0); BOOST_TEST(postcondition(x, 0));
    tracker.compare(x);

    x.max_load_factor(50.0);
    x.rehash(0); BOOST_TEST(postcondition(x, 0));
    tracker.compare(x);

    x.rehash(1000); BOOST_TEST(postcondition(x, 1000));
    tracker.compare(x);
}
Example #9
0
Library::~Library()
{
  components.clear();
  components.unregisterObserver(this);
  postcondition(components.empty());
}
Example #10
0
//
// MREngine implementation in MRE
//
BOOL
MRE::FInit ( PMreToPdb pmretopdb, BOOL fWrite, BOOL fClosePdb ) {
	BOOL	fRet = fFalse;
	
	precondition ( pmretopdb );
	precondition ( pmretopdb->ppdb );
	precondition ( pmretopdb->pnamemap );

	// don't assert that we have a ptpi or ppdbPdbFIle, as we have
	//	cases where we don't need it and it is not supplied.
	
	precondition ( pmretopdb->pvReserved1 == NULL );
	precondition ( pmretopdb->pvReserved2 == NULL );

	__try {
		m_fWrite = fWrite;
		m_fClosePdb = fClosePdb;
		m_ppdb = pmretopdb->ppdb;
		m_pnamemap = pmretopdb->pnamemap;
		m_ptpi = pmretopdb->ptpi;
		if (!m_ppdb->OpenStream ( SZ(c_szMreFileInfo), &m_pstreamFileInfo ) ||
			!m_ppdb->OpenStream ( SZ(c_szMreClassInfo), &m_pstreamClassInfo ) ||
			!m_ppdb->OpenStream ( SZ(c_szMreClassMods), &m_pstreamClassMods) ||
			!m_ppdb->OpenStream ( SZ(c_szMreFileMods), &m_pstreamFileMods ) ||
			!m_ppdb->OpenStream ( SZ(c_szMreRudeFiles), &m_pstreamRudeFiles)
			) {
			__leave;
			}

		assert ( m_pstreamFileInfo );
		assert ( m_pstreamClassInfo );
		assert ( m_pstreamClassMods );
		assert ( m_pstreamFileMods );
		assert ( m_pstreamRudeFiles );

		m_mpnifi.reloadStream ( m_pstreamFileInfo );
		m_mpnici.reloadStream ( m_pstreamClassInfo );
		m_rgtagniPending.reloadStream ( m_pstreamFileMods );
		m_rgtagclsdep.reloadStream ( m_pstreamClassMods );
		m_rgtagniRude.reloadStream ( m_pstreamRudeFiles );

		// cache away the sizes to see if we have to rewrite the stream
		m_itagclsdepSav = m_rgtagclsdep.size();
		m_ftagniPendingDirty = fFalse;
		m_itagniRudeSav = m_rgtagniRude.size();

		// second stage initializations.
		m_mrelog.FInit ( this, m_fWrite );
		m_lcrechandler.Init ( this );
		
		// now check to see if we have a matching pdb signature or init it if
		// we haven't gotten it yet.
		if ( pmretopdb->ppdbPdbFile ) {
			SIG		sigNew = pmretopdb->ppdbPdbFile->QuerySignature();
			SIG &	sigCur = SigMatchingPdbFile();
			if ( sigCur && sigCur != sigNew ) {
				FDelete();
				}
			sigCur = sigNew;
			}
			
		fRet = fTrue;
		}

	__finally {
		if ( !fRet ) {
			if ( m_pstreamFileInfo ) {
				m_pstreamFileInfo->Release();
				}
			if ( m_pstreamClassInfo ) {
				m_pstreamClassInfo->Release();
				}
			if ( m_pstreamClassMods ) {
				m_pstreamClassMods->Release();
				}
			if ( m_pstreamFileMods ) {
				m_pstreamFileMods->Release();
				}
			if ( m_pstreamRudeFiles ) {
				m_pstreamRudeFiles->Release();
				}
			m_pstreamFileInfo = 0;
			m_pstreamClassInfo = 0;
			m_pstreamClassMods = 0;
			m_pstreamFileMods = 0;
			m_pstreamRudeFiles = 0;
			m_pnamemap = 0;
			m_ppdb = 0;
			}
		else {
			postcondition ( m_pstreamFileInfo );
			postcondition ( m_pstreamClassMods );
			postcondition ( m_pstreamFileMods );
			postcondition ( m_pstreamRudeFiles );
			postcondition ( m_pnamemap );
			postcondition ( m_ppdb );
			}
		}
	
	return fRet;
	}