Esempio n. 1
0
void __fastcall TAddMachine::SaveClick(TObject *Sender)
{
	std::pair< TDate, TDate > dates( dtpValidFrom -> Date, dtpValidTo -> Date );
	bool validDate = (dates.second > dates.first
				 && dates.second > Now() && dates.first < Now());

	if( rgStatus -> ItemIndex == RGS_ACTIVE && !validDate )
		Application->MessageBox( "Invalid from/to dates", NULL, MB_OK);

	else if( MachineName->Text.IsEmpty() )
		Application->MessageBox( "Invalid machine name", NULL, MB_OK );

	else if( Location->Text.IsEmpty() )
		Application->MessageBox( "Location must have a value", NULL, MB_OK );
	else
	{	LCDbAnalyser theMachine( analyserID );
		theMachine.setName( MachineName->Text );
		theMachine.setDescription( Description->Text.SubString( 1, 64 ) );
		theMachine.setValidDates( dates );
		theMachine.setLocation( Location->Text );
		theMachine.setActive( rgStatus -> ItemIndex == RGS_ACTIVE );

		const LCDbObject * cluster = LCDbObjects::records().find( cbxCluster -> Text, LCDbObject::CLUSTER );
		theMachine.setClusterID( cluster == NULL ? 0 : cluster -> getID() );
		theMachine.saveRecord( QueryCentral );
		Close();
	}
}
int between_days(struct node *date1head, struct node *date2head){
	if (date1head==NULL || date2head==NULL)
	return -1;
	int res = dates(date1head, date2head);
	if (res == 0)
		return 0;
	else
		return res;
}
Esempio n. 3
0
QList<int> Database::lastThreeDays()
{
    int current_day = QDate(1,1,1).daysTo(QDate::currentDate());

    const QSet<int> & tmp_res = dates().toSet();

    QList<int> result;
    if( tmp_res.contains(current_day) )
        result << current_day;
    if( tmp_res.contains(current_day-1) )
        result << current_day-1;
    if( tmp_res.contains(current_day-2) )
        result << current_day-2;

    return result;
}
Esempio n. 4
0
    void InflationIndex::addFixing(const Date& fixingDate,
                                   Real fixing,
                                   bool forceOverwrite) {

        std::pair<Date,Date> lim = inflationPeriod(fixingDate, frequency_);
        Size n = lim.second - lim.first + 1;
        std::vector<Date> dates(n);
        std::vector<Rate> rates(n);
        for (Size i=0; i<n; ++i) {
            dates[i] = lim.first + i;
            rates[i] = fixing;
        }

        Index::addFixings(dates.begin(), dates.end(),
                          rates.begin(), forceOverwrite);
    }
Esempio n. 5
0
void __fastcall TAddBoxSize::SaveClick(TObject *Sender)
{
	int validform = true;
	std::pair< TDate, TDate > dates( dtpFrom -> Date, dtpTo -> Date );
	if( cbActive -> Checked	&& (dates.second < dates.first
	  || dates.first > Now() || dates.second < Now()) )
	{
		Application->MessageBox( "Invalid date range", NULL, MB_OK );
		validform = false;
	}

	if( edtDescription->Text.IsEmpty() )
	{
		Application->MessageBox( "Invalid Description", NULL, MB_OK );
		validform = false;
	}

	short size = edtCapacity->Text.ToIntDef( 0 );
	if( size < 2 )
	{
		Application->MessageBox( "Invalid Capacity", NULL, MB_OK );
		validform = false;
	}

	short hole = edtEmptyPos->Text.ToIntDef( 0 );
	if( hole > size )
	{
		Application->MessageBox( "Invalid empty position", NULL, MB_OK );
		validform = false;
	}

	if( validform )
	{
		LCDbBoxSize theBoxSize( boxSizeID );
		theBoxSize.setName( edtDescription->Text );
		theBoxSize.setValidDates( dates );
		theBoxSize.setActive( cbActive -> Checked );
		theBoxSize.setSize( size );
		theBoxSize.setHole( hole );
		if( cbVacutainer -> Checked )
			theBoxSize.setTube( LCDbBoxSize::VACUTAINER );
		else
			theBoxSize.setTube( LCDbBoxSize::CRYOVIAL );
		theBoxSize.saveRecord( QueryCentral );
		this->Close();
	}
}
Esempio n. 6
0
int main(int , char **)
{
    DataBase db;
    qDebug() << "Generating data files...";
    db.set_movie_dates = true;
    db.load();
    db.generateMovieDatabase();
//	db.generateProbeDates();
    db.generateQualDates();
    db.setUserDates();
    qDebug() << "Finished generating data files.";
    Dates dates(&db);
    Probe probe(&db);
    qDebug() << "Generating " << QUALIFYINGFILENAME << ".data file...";
    probe.readProbeData(db.rootPath()+"/qualifying.txt");
    return probe.runProbe(&dates);
}
	HullWhiteTimeDependentParameters calibration_hull_white(
		const Date& evalDate,
		const SwaptionVolData& volData
		)
	{
			boost::shared_ptr<IborIndex> index = volData.index;
			Frequency fixedFreq = volData.fixedFreq;
			DayCounter fixedDC = volData.fixedDC;
			DayCounter floatingDC = volData.floatingDC;
			Real FixedA = volData.fixedA;
			std::vector<Real> initialSigma = volData.initialSigma;

			Settings::instance().evaluationDate() = Date( evalDate.serialNumber() );

			Date today  = Settings::instance().evaluationDate();
			std::vector<Date> tmpdates;
			for (Size i=0; i<volData.maturities.size(); ++i){
				tmpdates.push_back(today+volData.maturities[i]);
			}
			tmpdates.back() = today+50*Years;

			std::set<Date> dateSet( tmpdates.begin(), tmpdates.end() );
			std::vector<Date> dates( dateSet.begin(), dateSet.end()	);

			Handle<YieldTermStructure> rts_hw(index->forwardingTermStructure().currentLink());
			//boost::shared_ptr<GeneralizedHullWhite> model(new GeneralizedHullWhite(rts_hw, dates, dates, std::vector<Real>(1, FixedA), initialSigma));
			boost::shared_ptr<Generalized_HullWhite> model(new Generalized_HullWhite(rts_hw, dates, initialSigma, FixedA));

			//boost::shared_ptr<PricingEngine> engine_hw(new AnalyticCapFloorEngine(model));
			//boost::shared_ptr<PricingEngine> engine_hw(new TreeSwaptionEngine(model, 100));
			boost::shared_ptr<PricingEngine> engine_hw(new JamshidianSwaptionEngine(model));
			std::vector<boost::shared_ptr<CalibrationHelper> > swaptions;

			for (Size i=0; i<volData.maturities.size(); ++i) {
				boost::shared_ptr<CalibrationHelper> helper(
					new SwaptionHelper(volData.maturities[i],
					volData.lengths[i],
					Handle<Quote>(boost::shared_ptr<Quote>(new SimpleQuote(volData.vols[i]))),
					index, Period(fixedFreq),
					fixedDC, floatingDC,
					rts_hw, CalibrationHelper::PriceError));
				helper->setPricingEngine(engine_hw);
				swaptions.push_back(helper);
			}

			LevenbergMarquardt optimizationMethod(1.0e-8,1.0e-8,1.0e-8);
			EndCriteria endCriteria(50000, 1000, 1e-8, 1e-8, 1e-8);

			model->calibrate(swaptions, optimizationMethod, endCriteria);
			EndCriteria::Type ecType = model->endCriteria();
			Array xMinCalculated = model->params();

			//Real a = xMinCalculated[0];
			//Real sigmar = xMinCalculated[1];
			std::vector<Real> sigma;				
			for (Size i=0; i<xMinCalculated.size(); ++i) {
				sigma.push_back(xMinCalculated[i]);
			}

			return HullWhiteTimeDependentParameters(FixedA, dates, sigma, model, swaptions);
	}
High_Score::High_Score(SharedStore* store) :
	bgTex(L"Texture/ColtonTitleBackground.png"),
	black(L"Texture/Planes/black.png"),
	font(L"Arial"),
	menufont(L"Arial"),
	scoreText(L"", &font),
	dateText(L"", &font),
	menuText(L"Back", &menufont),
	Scene(store)
{
	//adding song information to the store for smooth music transition
	store->oldBaseVol = store->songBaseVol;
	store->songBaseVol = SONG_VOLUME;
	store->songPath = "BGM/Monkeys Spinning Monkeys.mp3";

	//registering the button and the button responder
	gMessageHandler->AddRecipient(&menu, RHIGHSCORE);
	store->msgTgt = RHIGHSCORE;
	gMessageHandler->AddRecipient(&messageBox, RHIGHSCORESCENE);

	//bg
	bg.setTexture(bgTex);

	std::vector<std::wstring> scores(5);
	std::vector<std::wstring> dates(5);

	std::wifstream file("hiscores.txt");
	assert(file && "Failed to open file.");

	for (int i = 0; i < 5; i++) {
		std::getline(file, scores[i]);
		std::getline(file, dates[i]);
	}

	//Set Scores
	std::wstringstream ss;
	for (auto str : scores) {
		ss << str << "\n";
	}
	scoreText.setString(ss.str());
	ss.str(L"");
	for (auto str : dates) {
		ss << str << "\n";
	}
	dateText.setString(ss.str());

	//primary text
	GSPRect textRect(400.0f, 200.0f, 150.0f, 400.0f);
	scoreText.setRect(textRect);
  textRect.x += 200.0f;
	dateText.setRect(textRect);
	
  textRect.x -= 210.0f;
  textRect.width += 170;
  textRect.y -= 10.0f;
  textRect.height = 140.0f;
  textBox.setBitmap(black);
  textBox.destRect = textRect;
  textBox.opacity = 0.8f;

	//button
	menufont.setSize(35.0f);
	menufont.setColor(D2D1::ColorF::Black);
	Texture btnTex(L"Texture/buttons.png");
	std::vector<Sprite> btnSpr;

	//config first button; button textures are three buttons tiled one above another
	btnSpr.emplace_back();
	btnSpr[0].setBitmap(btnTex);
	btnSpr[0].srcRect.height /= 3;

	btnSpr[0].destRect = GSPRect(0, 0, 100.0f, 50.0f);
	btnSpr[0].destRect.x = store->screenWidth - (btnSpr[0].destRect.width + 10);
	btnSpr[0].destRect.y = store->screenHeight - (btnSpr[0].destRect.height + 10);

	//make copies of buttons, then adjust 'em
	btnSpr.push_back(btnSpr.back());
	btnSpr.back().srcRect.y += btnSpr.back().srcRect.height;
	btnSpr.push_back(btnSpr.back());
	btnSpr.back().srcRect.y += btnSpr.back().srcRect.height;

	menu.AddButton(btnSpr[0], btnSpr[1], btnSpr[2], btnSpr[0].destRect, GSPMessage(RHIGHSCORESCENE, 1));

	GSPRect btnRect = btnSpr[0].destRect;
	btnRect.moveBy(vec2f{ 10.0f, 5.0f });
	menuText.setRect(btnRect);
}
		void BaseCalendarUpdateAction::_doCalendarUpdate(
			Calendar& object,
			server::Request& request
		) const {

			// Link to remove
			if(_linkToRemove)
			{
				DeleteQuery<CalendarLinkTableSync> deleteQuery;
				deleteQuery.addWhereField(TABLE_COL_ID, *_linkToRemove);
				deleteQuery.execute();
			}

			// Add date
			if(!object.isLinked() && !_addLink)
			{
				// Preparation of the mask
				Calendar mask;
				if(	!_startDate.is_not_a_date() && !_endDate.is_not_a_date())
				{
					for (date d = _startDate; d <= _endDate; d += _period)
					{
						mask.setActive(d);
					}
				}
				if(_calendarTemplate.get())
				{
					if(!mask.empty())
					{
						mask = _calendarTemplate->getResult(mask);
					}
					else if(_calendarTemplate->isLimited())
					{
						mask = _calendarTemplate->getResult();
					}
					else if(_calendarTemplate2.get() && _calendarTemplate2->isLimited())
					{
						mask = _calendarTemplate->getResult(_calendarTemplate2->getResult());
					}
				}
				if(_calendarTemplate2.get())
				{
					if(!mask.empty())
					{
						mask = _calendarTemplate2->getResult(mask);
					}
					else if(_calendarTemplate2->isLimited())
					{
						mask = _calendarTemplate2->getResult();
					}
				}

				// Applying the mask
				if(	!mask.empty())
				{
					if(_add)
					{
						object |= mask;
					}
					else
					{
						object -= mask;
					}
				}
			}
			else if(_calendarUpdateToDo()) // Add link
			{
				CalendarLink link;
				link.setCalendar(&object);
				link.setStartDate(_startDate);
				link.setEndDate(_endDate);
				link.setCalendarTemplate(_calendarTemplate.get());
				link.setCalendarTemplate2(_calendarTemplate2.get());
				CalendarLinkTableSync::Save(&link);
			}


			// Storage of parameters in session variable
			if( !_startDate.is_not_a_date() &&
				!_endDate.is_not_a_date() &&
				_startDate != _endDate
			){
				if(!_startDate.is_not_a_date() && !_startDate.is_special())
				{
					request.getSession()->setSessionVariable(
						SESSION_VARIABLE_SERVICE_ADMIN_START_DATE,
						to_iso_extended_string(_startDate)
					);
				}
				if(!_endDate.is_not_a_date() && !_endDate.is_special())
				{
					request.getSession()->setSessionVariable(
						SESSION_VARIABLE_SERVICE_ADMIN_END_DATE,
						to_iso_extended_string(_endDate)
					);
				}
			}
			if(_calendarTemplate.get())
			{
				request.getSession()->setSessionVariable(
					SESSION_VARIABLE_SERVICE_ADMIN_CALENDAR_TEMPLATE_ID,
					lexical_cast<string>(_calendarTemplate->getKey())
				);
			}
			if(_calendarTemplate2.get())
			{
				request.getSession()->setSessionVariable(
					SESSION_VARIABLE_SERVICE_ADMIN_CALENDAR_TEMPLATE_ID2,
					lexical_cast<string>(_calendarTemplate2->getKey())
				);
			}

			// Dates to force to add
			if(!_dateToForceToAdd.is_not_a_date())
			{
				Calendar::DatesSet dates(object.getDatesToForce());
				dates.insert(_dateToForceToAdd);
				object.setDatesToForce(dates);
				object.setActive(_dateToForceToAdd);

				// Add date if non linked calendar (linked calendar behavior emulation)
				object.setActive(_dateToForceToAdd);
			}

			// Dates to force to remove
			if(!_dateToForceToRemove.is_not_a_date())
			{
				Calendar::DatesSet dates(object.getDatesToForce());
				dates.erase(_dateToForceToRemove);
				object.setDatesToForce(dates);
				object.setInactive(_dateToForceToRemove);
			}

			// Dates to bypass to add
			if(!_dateToBypassToAdd.is_not_a_date())
			{
				// Add date to bypass
				Calendar::DatesSet dates(object.getDatesToBypass());
				dates.insert(_dateToBypassToAdd);
				object.setDatesToBypass(dates);

				// Remove date if non linked calendar (linked calendar behavior emulation)
				object.setInactive(_dateToBypassToAdd);
			}

			// Dates to bypass to remove
			if(!_dateToBypassToRemove.is_not_a_date())
			{
				Calendar::DatesSet dates(object.getDatesToBypass());
				dates.erase(_dateToBypassToRemove);
				object.setDatesToBypass(dates);
				object.setActive(_dateToBypassToRemove);
			}
		}
Esempio n. 10
0
void
main(int argc, char *argv[])
{
	int i, fd, ahead;
	int32_t now;
	char *line;
	Tm *tm;
	Date *d;
	char buf[1024];

	ahead = 0;
	ARGBEGIN{
	case 'y':
		matchyear = 1;
		break;
	case 'd':
		debug = 1;
		break;
	case 'p':
		ahead = atoi(EARGF(usage()));
		break;
	default:
		usage();
	}ARGEND;

	/* make a list of dates */
	now = time(0);
	tm = localtime(now);
	dates(tm);
	now += Secondsperday;
	tm = localtime(now);
	dates(tm);
	if(tm->wday == 6){
		now += Secondsperday;
		tm = localtime(now);
		dates(tm);
	}
	if(tm->wday == 0){
		now += Secondsperday;
		tm = localtime(now);
		dates(tm);
	}
	if(ahead){
		now = time(0);
		now += ahead * Secondsperday;
		tm = localtime(now);
		dates(tm);
	}

	for(i=0; i<argc || (i==0 && argc==0); i++){
		if(i==0 && argc==0)
			snprint(buf, sizeof buf,
				"/usr/%s/lib/calendar", getuser());
		else
			strecpy(buf, buf+sizeof buf, argv[i]);
		fd = open(buf, OREAD);
		if(fd<0 || Binit(&in, fd, OREAD)<0){
			fprint(2, "calendar: can't open %s: %r\n", buf);
			exits("open");
		}

		/* go through the file */
		while(line = Brdline(&in, '\n')){
			line[Blinelen(&in) - 1] = 0;
			upper2lower(buf, line, sizeof buf);
			for(d=Base; d; d=d->next)
				if(regexec(d->p, buf, 0, 0)){
					print("%s\n", line);
					break;
				}
		}
		close(fd);
	}
	exits("");
}
Esempio n. 11
0
VOID KSceneSettingDialogV2::InitGrid()
{
	// Add "About..." menu item to system menu.
#if 1
	// get the size of the place holder, this will be used when creating the grid.

	CRect rc(0,0,100,100);
	
	{
		HWND hWnd = NULL;
		this->GetDlgItem(IDC_CUSTOM1, &hWnd);
		if (NULL != hWnd)
		{
			::GetWindowRect(hWnd, &rc);
			ScreenToClient(&rc);
			::ShowWindow(hWnd, SW_HIDE);
		}
	}

	// create the property grid.
	if ( m_Grid.Create( rc, this, IDC_SCENESETTING_GRID) )
	{
		LOGFONT lf;
		GetFont()->GetLogFont( &lf );

		// create document settings category.
		CXTPPropertyGridItem* pSettings        = m_Grid.AddCategory(_T("Document Settings"));

		// add child items to category.
		CXTPPropertyGridItem* pItemSaveOnClose = pSettings->AddChildItem(new CXTPPropertyGridItemBool(_T("SaveOnClose"), TRUE));
		pSettings->AddChildItem(new CXTPPropertyGridItemFont(_T("WindowFont"), lf));
		pSettings->AddChildItem(new CXTPPropertyGridItemSize(_T("WindowSize"), CSize(100, 100)));

		pSettings->Expand();
		pItemSaveOnClose->Select();

		// create global settings category.
		CXTPPropertyGridItem* pGlobals      = m_Grid.AddCategory(_T("Global Settings"));

		// add child items to category.
		CXTPPropertyGridItem* pItemGreeting = pGlobals->AddChildItem(new CXTPPropertyGridItem(_T("Greeting Text"), _T("Welcome to your application!")));
		pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("ItemsInMRUList"), 4));
		CXTPPropertyGridItem* pItemRate     = pGlobals->AddChildItem(new CXTPPropertyGridItemNumber(_T("MaxRepeatRate"), 10));
		pGlobals->AddChildItem(new CXTPPropertyGridItemColor(_T("ToolbarColor"), RGB(255, 192,128)));

		pItemGreeting->SetReadOnly(TRUE);
		pItemRate->SetDescription(_T("The rate in milliseconds that the text will repeat."));

		// create version category.
		CXTPPropertyGridItem* pVersion      = m_Grid.AddCategory(_T("Version"));

		// add child items to category.
		CXTPPropertyGridItem* pItemVersion  = pVersion->AddChildItem(new CXTPPropertyGridItem(_T("AppVerion"), _T("1.0")));
		CXTPPropertyGridItem* pItemLanguage = pVersion->AddChildItem(new CXTPPropertyGridItem(IDC_COMBO1, _T("English (United States)")));

		pItemVersion->SetReadOnly(TRUE);
		pVersion->Expand();

		CXTPPropertyGridItemConstraints* pList = pItemLanguage->GetConstraints();

		pList->AddConstraint(_T("Neutral"));
		pList->AddConstraint(_T("Arabic"));
		pList->AddConstraint(_T("German"));
		pList->AddConstraint(_T("Chinese(Taiwan)"));
		pList->AddConstraint(_T("English (United Kingdom)"));
		pList->AddConstraint(_T("English (United States)"));
		pList->AddConstraint(_T("France"));
		pList->AddConstraint(_T("Russian"));

		pItemLanguage->SetFlags(xtpGridItemHasComboButton | xtpGridItemHasEdit);


		// create standard items category.
		CXTPPropertyGridItem* pStandard   = m_Grid.AddCategory(_T("Standard Items"));
		pStandard->AddChildItem(new CXTPPropertyGridItem(_T("String item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemNumber(_T("Integer item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemDouble(_T("Double item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemColor(_T("Color item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemBool(_T("Bool item")));
		pStandard->AddChildItem(new CXTPPropertyGridItemFont(_T("Font item"), lf));
		COleDateTime dates(1981, 1, 26, 0, 0, 0 );
		pStandard->AddChildItem(new CXTPPropertyGridItemDate(_T("Date item"), dates));
		pStandard->AddChildItem(new CXTPPropertyGridItemSize(_T("Size item")));

		CXTPPropertyGridItem* pItem = pStandard->AddChildItem(new CXTPPropertyGridItemEnum(_T("Enum item"), 2));
		pItem->GetConstraints()->AddConstraint(_T("Windows 98"), 1);
		pItem->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
		pItem->GetConstraints()->AddConstraint(_T("Windows XP"), 3);

		pItem = pStandard->AddChildItem(new CXTPPropertyGridItemFlags(_T("Flag item"), 1 + 2));
		pItem->GetConstraints()->AddConstraint(_T("All Windows"), 1 + 2 + 4);
		pItem->GetConstraints()->AddConstraint(_T("Windows 98"), 1);
		pItem->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
		pItem->GetConstraints()->AddConstraint(_T("Windows XP"), 4);



		// create custom items category.
		//CXTPPropertyGridItem* pCustom   = m_Grid.AddCategory(_T("Custom Items"));

		//// add child items to category.
		//CXTPPropertyGridItem* pItemIcon = pCustom->AddChildItem(new CCustomItemIcon(_T("Icon"), m_hIcon));
		//CXTPPropertyGridItem* pItemDock = pCustom->AddChildItem(new CCustomItemChilds(_T("DockPadding"), CRect(100, 20, 400, 50)));
		//pCustom->AddChildItem(new CCustomItemColor(_T("CustomCombolist"), RGB(0xFF, 0x80, 0x40)));

		//pItemIcon->SetDescription(_T("This sample shows how to override draw function"));
		//pItemDock->SetDescription(_T("This sample shows how to add item with childs"));

		//CXTPPropertyGridItem* pItemSpin = pCustom->AddChildItem(new CCustomItemSpin(_T("SpinButton")));
		//pItemSpin->SetDescription(_T("This sample shows how to add new button type"));
	}

//#ifdef _XTP_INCLUDE_CONTROLS
//	// Set control resizing.
//	SetResize(IDC_PROPERTY_GRID, SZ_TOP_LEFT, SZ_BOTTOM_RIGHT);
//
//	SetResize(IDC_GBOX_APPEAR,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_TOOLBAR,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_HELP,          SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_DOUBLE,        SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_TABITEMS,      SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_COMBO_THEME,      SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_GBOX_SORT,         SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_CATEGORIES,   SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_ALPHABETICAL, SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_SORT_NOSORT,       SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_GBOX_COLOR,        SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_CHK_CUSTOMCOLORS,  SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//	SetResize(IDC_BUTTON_SWITCHSTATE,  SZ_TOP_RIGHT, SZ_TOP_RIGHT);
//
//	// Load window placement
//	AutoLoadPlacement(_T("CPropertyGridDlg"));
//#endif
//
//	m_cmbTheme.AddString(_T("Default"));
//	m_cmbTheme.AddString(_T("NativeWinXP"));
//	m_cmbTheme.AddString(_T("Office2003"));
//	m_cmbTheme.AddString(_T("Cool"));
//	m_cmbTheme.AddString(_T("Simple"));
//	m_cmbTheme.AddString(_T("Delphi"));
//	m_cmbTheme.AddString(_T("Whidbey"));
//	m_cmbTheme.SetCurSel(0);
#endif

}
Esempio n. 12
0
int main(int argc, const char *argv[]) {
	options::single<int> number('N', "number", "some number", 0);
	options::single<int> number2('k', "kumber", "some other number", 0, {0, 3, 3});
	options::map<int, std::vector<std::pair<std::string, int> > > numbers('m', "numbers", "several numbers");
	options::map<std::string, std::list<std::pair<std::string, std::string> > > strings('s', "strings", "several strings");
	options::single<const char *>cs('c', "cstring", "a c string", "", {"bla", "blubb"});
	options::single<std::string>Cs('C', "Cstring", "a C++ string", "",  {"bla", "blubb"});
	options::container<double> dnums('d', "doubles", "double numbers");
	//	options::container<const char*, std::list<const char*>> stringl('S', "listString", "list of strings");
	options::container<std::string, std::list<std::string>> stringS('X', "liststring", "list of std::strings");
	options::single<double> complexDescription('\0', "ComplexDescription", "Pass here the Bremsstrahl-Tagging-Hodoscope-Engineering-Assemply-Rate in Hz", 84.);
	options::single<double> moreComplexDescription('\0', "MoreComplexDescription", "very complicated example option with very long explanation to illustrate automatic wrapping in help output when the explanations become very long and would break readability otherwise.", 42.);
	options::single<double> evenMoreComplexDescription('\0', "EvenMoreComplexDescription", "very complicated example option with very long explanation containing averylongwordwhichisunbreakableandthustriggersforcefulwordwrappinginaninconvenientplacetokeepthingssomehowatleastabitreadable.", 21.);

	options::single<options::postFixedNumber<size_t>> size('\0', "size", "a size");
	options::single<std::chrono::system_clock::time_point> date('\0', "date", "a date");
	options::single<std::chrono::duration<long>> dur('\0', "dur", "a duration");
	options::single<bool> lateOption('\0', "lateOption", "try to book an option late", false);
	cs.fForbid(&Cs);
	Cs.fForbid(&cs);

	options::container<std::chrono::system_clock::time_point> dates('\0', "dates", "list of dates");

	options::OptionsForTApplication TApplicationOptions(argv[0]);

	options::positional<options::single<float>>posNumber(10, "posnumber", "positional float number", 0);
	options::positional<options::container<std::string>>files(20, "files", "positional file list");
	options::positional<options::single<const char *>>dest(30, "dest", "positional destination file", "");

	options::parser parser("option parsing example");

	parser.fRequire(&number);

	auto unusedOptions = parser.fParse(argc, argv);

	TApplicationOptions.fFinalize(unusedOptions.begin(), unusedOptions.end());

	for (auto & unusedOption : unusedOptions) {
		std::cout << "unused option : '" << unusedOption << "'" << std::endl;
	}
	for (auto & num : numbers) {
		std::cout << " number '" << num.first << "' is '" << num.second << "'\n";
	}
	for (auto & str : strings) {
		std::cout << " string '" << str.first << "' is '" << str.second << "'\n";
	}
	for (double & dnum : dnums) {
		std::cout << " double number '" << dnum << "'\n";
	}
	//	for (auto & it : stringl) {
	//	std::cout << " list string '" << it << "'\n";
	//}
	for (auto & it : stringS) {
		std::cout << " list std::string '" << it << "'\n";
	}

	std::cout << "and the time variable is:";
	date.fWriteValue(std::cout);
	auto timebuf = std::chrono::system_clock::to_time_t(date);
	std::cout << ", that is " << std::ctime(&timebuf);

	std::cout << "the duration is: ";
	dur.fWriteValue(std::cout);
	std::cout << " or " << std::chrono::duration_cast<std::chrono::hours>(dur).count()  << " hours \n";

	if (lateOption) {
		options::single<bool> optionLate('\0', "lateOptionTest", "option booked late", false);
	}

	return number;
}
Esempio n. 13
0
int main()
{
  MpmNetwork network("Début", "Fin");
  GraphvizAttributesHolder config;

  typedef Exporter<MpmTask> Export;

  {
    Graph<PlanningActivity> activities(GraphTypes::DIRECTED, GraphTypes::UNWEIGHTED, GraphTypes::CONTAINER);

    //ajout des tâches
    activities.add_node( 1, PlanningActivity("A", 50) );
    activities.add_node( 2, PlanningActivity("B", 45) );
    activities.add_node( 3, PlanningActivity("C", 15) );
    activities.add_node( 4, PlanningActivity("D", 10) );
    activities.add_node( 5, PlanningActivity("E", 30) );
    activities.add_node( 6, PlanningActivity("F", 20) );
    activities.add_node( 7, PlanningActivity("G", 8) );
    activities.add_node( 8, PlanningActivity("H", 8) );
    activities.add_node( 9, PlanningActivity("I", 5) );
    activities.add_node( 10, PlanningActivity("J", 6) );
    activities.add_node( 11, PlanningActivity("K", 6) );
    activities.add_node( 12, PlanningActivity("L", 2) );
    activities.add_node( 13, PlanningActivity("M", 6) );
    activities.add_node( 14, PlanningActivity("N", 1) );
  
    //informations de précédence
    activities.add_edge(1,3);
    activities.add_edge(1,4);
    activities.add_edge(1,6);
    activities.add_edge(1,7);
    activities.add_edge(1,8);
    activities.add_edge(1,9);
    activities.add_edge(1,10);
    activities.add_edge(1,11);
    activities.add_edge(1,12);
    activities.add_edge(1,13);
    activities.add_edge(1,14);

    activities.add_edge(2,3);
    activities.add_edge(2,4);
    activities.add_edge(2,5);
    activities.add_edge(2,10);
    activities.add_edge(2,11);
    activities.add_edge(2,12);
    activities.add_edge(2,13);
    activities.add_edge(2,14);

    activities.add_edge(4,13);
    activities.add_edge(4,12);
    activities.add_edge(4,11);
    activities.add_edge(4,14);

    activities.add_edge(5,10);
    activities.add_edge(5,14);

    activities.add_edge(6,8);
    activities.add_edge(6,9);
    activities.add_edge(6,10);
    activities.add_edge(6,14);

    activities.add_edge(7,10);
    activities.add_edge(7,14);

    activities.add_edge(8,10);
    activities.add_edge(8,14);

    activities.add_edge(9,10);
    activities.add_edge(9,14);

    activities.add_edge(11,12);
    activities.add_edge(11,14);

    Exporter<PlanningActivity>::ToGraphviz(activities, "bin/activityGraph.graph");

    MpmNetworkBuilder mpmBuilder(activities);

    mpmBuilder.buildInto(network);
  }
  
  MpmDatesComputer dates(network);
  dates.compute();

  config.setGraphLabel("MPM chart TP1");
  Export::GraphvizMpmPrepare(network, config);
  Export::GraphvizPathHighlight( config, dates.criticalPath() );
  Export::ToGraphviz(network, config, "bin/MPM_chart.graph");

  system("dot -Tpng bin/MPM_chart.graph -o bin/MPM_chart.png");

  return 0;
}