예제 #1
0
Reservation
VolumeReservationImpl::Make(const std::string &assetpath,
                            const khFusionURI &uri) {
  try {
    return Reservation(khRefGuardFromNew(
        new VolumeReservationImpl(assetpath, uri)));
  } catch (...) {
    return Reservation();
  }
}
예제 #2
0
bool FenetreSaisie::qt_invoke( int _id, QUObject* _o )
{
	switch ( _id - staticMetaObject()->slotOffset() ) {
		case 0: Login(); break;
		case 1: Terminer(); break;
		case 2: Reservation(); break;
		case 3: SelectionnerOk0(); break;
		case 4: SelectionnerOk1(); break;
		case 5: SelectionnerOk2(); break;
		case 6: SelectionnerOk3(); break;
		case 7: SelectionnerOk4(); break;
		case 8: SelectionnerOk((int)static_QUType_int.get(_o+1)); break;
		case 9: Precedent(); break;
		case 10: Suivant(); break;
		case 11: Effacer(); break;
		case 12: Recherche(); break;
		case 13: Rendu0(); break;
		case 14: Rendu1(); break;
		case 15: Rendu2(); break;
		case 16: Rendu((int)static_QUType_int.get(_o+1)); break;
		case 17: languageChange(); break;
		default:
		return QDialog::qt_invoke( _id, _o );
	}
	return TRUE;
}
Reservation
khResourceManager::MakeCPUReservation(khResourceProviderProxy *provider,
                                      const TaskRequirements::CPU &req)
{
  uint num = std::min(provider->AvailCPUs(), req.maxNumCPU);
  if (num >= req.minNumCPU) {
    provider->usedCPUs += num;
    return CPUReservationImpl::Make(provider->Host(), num);
  }
  return Reservation();
}
Reservation
khResourceManager::MakeVolumeReservation(const std::string &assetPath,
                                         const std::string &volume,
                                         const std::string &path,
                                         uint64 size)
{
  Volume *vol = GetVolume(volume);
  if (vol && vol->MakeReservation(path, size)) {
    return VolumeReservationImpl::Make(assetPath,
                                       khFusionURI(volume, path));
  }
  return Reservation();
}
예제 #5
0
/*
 *  Constructs a FenetreSaisie as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
FenetreSaisie::FenetreSaisie( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "FenetreSaisie" );

    textTitre = new QLabel( this, "textTitre" );
    textTitre->setGeometry( QRect( 210, 20, 160, 21 ) );
    QFont textTitre_font(  textTitre->font() );
    textTitre_font.setFamily( "Helvetica [Adobe]" );
    textTitre_font.setPointSize( 18 );
    textTitre_font.setBold( TRUE );
    textTitre->setFont( textTitre_font ); 
    textTitre->setAlignment( int( QLabel::AlignCenter ) );

    textNom = new QLabel( this, "textNom" );
    textNom->setGeometry( QRect( 30, 50, 59, 20 ) );

    lineSaisieNom = new QLineEdit( this, "lineSaisieNom" );
    lineSaisieNom->setGeometry( QRect( 100, 50, 220, 20 ) );

    ButtonLogin = new QPushButton( this, "ButtonLogin" );
    ButtonLogin->setGeometry( QRect( 440, 50, 85, 20 ) );
    ButtonLogin->setAutoDefault( FALSE );

    ButtonReservation = new QPushButton( this, "ButtonReservation" );
    ButtonReservation->setGeometry( QRect( 740, 420, 85, 20 ) );
    ButtonReservation->setAutoDefault( FALSE );

    ButtonTerminer = new QPushButton( this, "ButtonTerminer" );
    ButtonTerminer->setGeometry( QRect( 550, 50, 85, 20 ) );
    ButtonTerminer->setAutoDefault( FALSE );

    lineNom[0] = new QLineEdit( this, "lineNom" );
    lineNom[0]->setGeometry( QRect( 30, 110, 220, 20 ) );
    lineNom[0]->setReadOnly( TRUE );
    lineNom[1] = new QLineEdit( this, "lineNom" );
    lineNom[1]->setGeometry( QRect( 30, 135, 220, 20 ) );
    lineNom[1]->setReadOnly( TRUE );
    lineNom[2] = new QLineEdit( this, "lineNom" );
    lineNom[2]->setGeometry( QRect( 30, 160, 220, 20 ) );
    lineNom[2]->setReadOnly( TRUE );

    linePrenom[0] = new QLineEdit( this, "linePrenom" );
    linePrenom[0]->setGeometry( QRect( 260, 110, 160, 20 ) );
    linePrenom[0]->setReadOnly( TRUE );
    linePrenom[1] = new QLineEdit( this, "linePrenom" );
    linePrenom[1]->setGeometry( QRect( 260, 135, 160, 20 ) );
    linePrenom[1]->setReadOnly( TRUE );
    linePrenom[2] = new QLineEdit( this, "linePrenom" );
    linePrenom[2]->setGeometry( QRect( 260, 160, 160, 20 ) );
    linePrenom[2]->setReadOnly( TRUE );

    lineTitre[0] = new QLineEdit( this, "lineTitre" );
    lineTitre[0]->setGeometry( QRect( 430, 110, 290, 20 ) );
    lineTitre[0]->setReadOnly( TRUE );
    lineTitre[1] = new QLineEdit( this, "lineTitre" );
    lineTitre[1]->setGeometry( QRect( 430, 135, 290, 20 ) );
    lineTitre[1]->setReadOnly( TRUE );
    lineTitre[2] = new QLineEdit( this, "lineTitre" );
    lineTitre[2]->setGeometry( QRect( 430, 160, 290, 20 ) );
    lineTitre[2]->setReadOnly( TRUE );

    ButtonRendu[0] = new QPushButton( this, "ButtonRendu" );
    ButtonRendu[0]->setGeometry( QRect( 740, 110, 85, 20 ) );
    ButtonRendu[0]->setAutoDefault( FALSE );
    ButtonRendu[1] = new QPushButton( this, "ButtonRendu" );
    ButtonRendu[1]->setGeometry( QRect( 740, 135, 85, 20 ) );
    ButtonRendu[1]->setAutoDefault( FALSE );
    ButtonRendu[2] = new QPushButton( this, "ButtonRendu" );
    ButtonRendu[2]->setGeometry( QRect( 740, 160, 85, 20 ) );
    ButtonRendu[2]->setAutoDefault( FALSE );

    ButtonPrecedent = new QPushButton( this, "ButtonPrecedent" );
    ButtonPrecedent->setGeometry( QRect( 60, 365, 85, 20 ) );
    ButtonPrecedent->setAutoDefault( FALSE );

    ButtonEffacer = new QPushButton( this, "ButtonEffacer" );
    ButtonEffacer->setGeometry( QRect( 330, 365, 85, 20 ) );
    ButtonEffacer->setAutoDefault( FALSE );

    ButtonSuivant = new QPushButton( this, "ButtonSuivant" );
    ButtonSuivant->setGeometry( QRect( 600, 365, 85, 20 ) );
    ButtonSuivant->setAutoDefault( FALSE );

    lineRecherche = new QLineEdit( this, "lineRecherche" );
    lineRecherche->setGeometry( QRect( 430, 190, 290, 20 ) );

    lineNomOk[0] = new QLineEdit( this, "lineNomOk" );
    lineNomOk[0]->setGeometry( QRect( 30, 230, 220, 20 ) );
    lineNomOk[0]->setReadOnly( TRUE );
    lineNomOk[1] = new QLineEdit( this, "lineNomOk" );
    lineNomOk[1]->setGeometry( QRect( 30, 255, 220, 20 ) );
    lineNomOk[1]->setReadOnly( TRUE );
    lineNomOk[2] = new QLineEdit( this, "lineNomOk" );
    lineNomOk[2]->setGeometry( QRect( 30, 280, 220, 20 ) );
    lineNomOk[2]->setReadOnly( TRUE );
    lineNomOk[3] = new QLineEdit( this, "lineNomOk" );
    lineNomOk[3]->setGeometry( QRect( 30, 305, 220, 20 ) );
    lineNomOk[3]->setReadOnly( TRUE );
    lineNomOk[4] = new QLineEdit( this, "lineNomOk" );
    lineNomOk[4]->setGeometry( QRect( 30, 330, 220, 20 ) );
    lineNomOk[4]->setReadOnly( TRUE );

    linePrenomOk[0] = new QLineEdit( this, "linePrenomOk" );
    linePrenomOk[0]->setGeometry( QRect( 260, 230, 160, 20 ) );
    linePrenomOk[0]->setReadOnly( TRUE );
    linePrenomOk[1] = new QLineEdit( this, "linePrenomOk" );
    linePrenomOk[1]->setGeometry( QRect( 260, 255, 160, 20 ) );
    linePrenomOk[1]->setReadOnly( TRUE );
    linePrenomOk[2] = new QLineEdit( this, "linePrenomOk" );
    linePrenomOk[2]->setGeometry( QRect( 260, 280, 160, 20 ) );
    linePrenomOk[2]->setReadOnly( TRUE );
    linePrenomOk[3] = new QLineEdit( this, "linePrenomOk" );
    linePrenomOk[3]->setGeometry( QRect( 260, 305, 160, 20 ) );
    linePrenomOk[3]->setReadOnly( TRUE );
    linePrenomOk[4] = new QLineEdit( this, "linePrenomOk" );
    linePrenomOk[4]->setGeometry( QRect( 260, 330, 160, 20 ) );
    linePrenomOk[4]->setReadOnly( TRUE );

    lineTitreOk[0] = new QLineEdit( this, "lineTitreOk" );
    lineTitreOk[0]->setGeometry( QRect( 430, 230, 270, 20 ) );
    lineTitreOk[0]->setReadOnly( TRUE );
    lineTitreOk[1] = new QLineEdit( this, "lineTitreOk" );
    lineTitreOk[1]->setGeometry( QRect( 430, 255, 270, 20 ) );
    lineTitreOk[1]->setReadOnly( TRUE );
    lineTitreOk[2] = new QLineEdit( this, "lineTitreOk" );
    lineTitreOk[2]->setGeometry( QRect( 430, 280, 270, 20 ) );
    lineTitreOk[2]->setReadOnly( TRUE );
    lineTitreOk[3] = new QLineEdit( this, "lineTitreOk" );
    lineTitreOk[3]->setGeometry( QRect( 430, 305, 270, 20 ) );
    lineTitreOk[3]->setReadOnly( TRUE );
    lineTitreOk[4] = new QLineEdit( this, "lineTitreOk" );
    lineTitreOk[4]->setGeometry( QRect( 430, 330, 270, 20 ) );
    lineTitreOk[4]->setReadOnly( TRUE );

    lineReserveOk[0] = new QLineEdit( this, "lineReserveOk" );
    lineReserveOk[0]->setGeometry( QRect( 700, 230, 20, 20 ) );
    lineReserveOk[0]->setReadOnly( TRUE );
    lineReserveOk[1] = new QLineEdit( this, "lineReserveOk" );
    lineReserveOk[1]->setGeometry( QRect( 700, 255, 20, 20 ) );
    lineReserveOk[1]->setReadOnly( TRUE );
    lineReserveOk[2] = new QLineEdit( this, "lineReserveOk" );
    lineReserveOk[2]->setGeometry( QRect( 700, 280, 20, 20 ) );
    lineReserveOk[2]->setReadOnly( TRUE );
    lineReserveOk[3] = new QLineEdit( this, "lineReserveOk" );
    lineReserveOk[3]->setGeometry( QRect( 700, 305, 20, 20 ) );
    lineReserveOk[3]->setReadOnly( TRUE );
    lineReserveOk[4] = new QLineEdit( this, "lineReserveOk" );
    lineReserveOk[4]->setGeometry( QRect( 700, 330, 20, 20 ) );
    lineReserveOk[4]->setReadOnly( TRUE );

    ButtonSelectionnerOk[0] = new QPushButton( this, "ButtonSelectionnerOk" );
    ButtonSelectionnerOk[0]->setGeometry( QRect( 740, 230, 85, 20 ) );
    ButtonSelectionnerOk[0]->setAutoDefault( FALSE );
    ButtonSelectionnerOk[1] = new QPushButton( this, "ButtonSelectionnerOk" );
    ButtonSelectionnerOk[1]->setGeometry( QRect( 740, 255, 85, 20 ) );
    ButtonSelectionnerOk[1]->setAutoDefault( FALSE );
    ButtonSelectionnerOk[2] = new QPushButton( this, "ButtonSelectionnerOk" );
    ButtonSelectionnerOk[2]->setGeometry( QRect( 740, 280, 85, 20 ) );
    ButtonSelectionnerOk[2]->setAutoDefault( FALSE );
    ButtonSelectionnerOk[3] = new QPushButton( this, "ButtonSelectionnerOk" );
    ButtonSelectionnerOk[3]->setGeometry( QRect( 740, 305, 85, 20 ) );
    ButtonSelectionnerOk[3]->setAutoDefault( FALSE );
    ButtonSelectionnerOk[4] = new QPushButton( this, "ButtonSelectionnerOk" );
    ButtonSelectionnerOk[4]->setGeometry( QRect( 740, 330, 85, 20 ) );
    ButtonSelectionnerOk[4]->setAutoDefault( FALSE );

    textSaisie = new QLabel( this, "textSaisie" );
    textSaisie->setGeometry( QRect( 30, 190, 330, 20 ) );

    textMessage = new QTextEdit( this, "textMessage" );
    textMessage->setGeometry( QRect( 30, 420, 685, 58 ) );
    textMessage->setReadOnly( TRUE );

    textInformation = new QLabel( this, "textInformation" );
    textInformation->setGeometry( QRect( 30, 390, 80, 20 ) );
    QFont textInformation_font(  textInformation->font() );
    textInformation_font.setFamily( "Helvetica [Adobe]" );
    textInformation_font.setBold( TRUE );
    textInformation->setFont( textInformation_font ); 

    textSelection = new QLabel( this, "textSelection" );
    textSelection->setGeometry( QRect( 30, 80, 180, 20 ) );
    languageChange();
    resize( QSize(850, 500).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( ButtonLogin, SIGNAL( clicked() ), this, SLOT( Login() ) );
    connect( ButtonReservation, SIGNAL( clicked() ), this, SLOT( Reservation() ) );
    connect( lineSaisieNom, SIGNAL( returnPressed() ), this, SLOT( Login() ) );
    connect( ButtonEffacer, SIGNAL( clicked() ), this, SLOT( Effacer() ) );
    connect( ButtonTerminer, SIGNAL( clicked() ), this, SLOT( Terminer() ) );
    connect( ButtonPrecedent, SIGNAL( clicked() ), this, SLOT( Precedent() ) );
    connect( ButtonSuivant, SIGNAL( clicked() ), this, SLOT( Suivant() ) );
    connect( lineRecherche, SIGNAL( returnPressed() ), this, SLOT( Recherche() ) );
    connect( ButtonRendu[0], SIGNAL( clicked() ), this, SLOT( Rendu0() ) );
    connect( ButtonRendu[1], SIGNAL( clicked() ), this, SLOT( Rendu1() ) );
    connect( ButtonRendu[2], SIGNAL( clicked() ), this, SLOT( Rendu2() ) );
    connect( ButtonSelectionnerOk[0], SIGNAL( clicked() ), this, SLOT( SelectionnerOk0() ) );
    connect( ButtonSelectionnerOk[1], SIGNAL( clicked() ), this, SLOT( SelectionnerOk1() ) );
    connect( ButtonSelectionnerOk[2], SIGNAL( clicked() ), this, SLOT( SelectionnerOk2() ) );
    connect( ButtonSelectionnerOk[3], SIGNAL( clicked() ), this, SLOT( SelectionnerOk3() ) );
    connect( ButtonSelectionnerOk[4], SIGNAL( clicked() ), this, SLOT( SelectionnerOk4() ) );
}
예제 #6
0
파일: runlogic.c 프로젝트: cavisson/nscore
void runlogic()
{
    NSDL2_RUNLOGIC(NULL, NULL, "Executing init_script()");

    init_script();

    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Parent");
    {

        NSDL2_RUNLOGIC(NULL, NULL, "Executing dowhile block - DoWhileBlock. NS Variable = var_dowhile");
        {

            NSDL2_RUNLOGIC(NULL, NULL, "NS Variable value for block - DoWhileBlock = %d", ns_get_int_val("var_dowhile"));
            do
            {

                NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Seq1");
                {

                    NSDL2_RUNLOGIC(NULL, NULL, "Executing weight block - Weight");
                    {
                        //int Weightweight = ns_get_random_number_int(1, 100);
                        int Weightweight = ns_get_random_number_int(1, weight);

                        NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Weight = %d", Weightweight);

                        //if(Weightweight <= 100)
                        if(Weightweight <= weight)
                        {

                            NSDL2_RUNLOGIC(NULL, NULL, "Executing percent block - Percentage (wt value = 100)");
                            {
                                //int Percentagepercent = ns_get_random_number_int(1, 100);
                                int Percentagepercent = ns_get_random_number_int(1, per1+per2);

                                NSDL2_RUNLOGIC(NULL, NULL, "Percentage random number for block - Percentage = %d", Percentagepercent);

                                //if(Percentagepercent <= 50)
                                if(Percentagepercent <= per1)
                                {
                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - LoginLogout (pct value = 50%)");
                                    LoginLogout();
                                }
                                //else if(Percentagepercent <= 100)
                                else if(Percentagepercent <= per1+per2)
                                {

                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing count block - Count. Min = 1, Max = 1 (pct value = 50%)");
                                    {
                                        //int CountCount = ns_get_random_number_int(1, 1);
                                        int CountCount = ns_get_random_number_int(min, max);
                                        int CountLoop;
                                         for(CountLoop = 1; CountLoop <= CountCount; CountLoop++)
                                        {

                                            NSDL2_RUNLOGIC(NULL, NULL, "Executing while block - while. NS Variable = var_while (pct value = 50%), SelectedCount = %d, Iteration = %d",CountCount, CountLoop);
                                            {

                                                NSDL2_RUNLOGIC(NULL, NULL, "NS Variable value for block - while = %d", ns_get_int_val("var_while"));
                                                while(ns_get_int_val("var_while"))
                                                {

                                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - SeqW (pct value = 50%), SelectedCount = %d, Iteration = %d",CountCount, CountLoop);
                                                    {

                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing switch block - Switch. NS Variable = var_switch (pct value = 50%), SelectedCount = %d, Iteration = %d",CountCount, CountLoop);
                                                        {

                                                            NSDL2_RUNLOGIC(NULL, NULL, "NS Variable value for block - Switch = %d", ns_get_int_val("var_switch"));
                                                            switch(ns_get_int_val("var_switch"))
                                                            {
                                                                case 0:

                                                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Seq2 (case value = 0), SelectedCount = %d, Iteration = %d",CountCount, CountLoop);
                                                                    {
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Passenger");
                                                                        Passenger();
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowSwitch");
                                                                        FlowSwitch();
                                                                    }
                                                                    break;
                                                                case 1:

                                                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Seq3 (case value = 1)");
                                                                    {
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Reservation");
                                                                        Reservation();
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowSwitch");
                                                                        FlowSwitch();
                                                                    }
                                                                    break;
                                                                case 2:

                                                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Seq4 (case value = 2)");
                                                                    {
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - LoginLogout");
                                                                        LoginLogout();
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowSwitch");
                                                                        FlowSwitch();
                                                                    }
                                                                    break;
                                                                default:

                                                                    NSDL2_RUNLOGIC(NULL, NULL, "Executing sequence block - Seq5 (case value = -1)");
                                                                    {
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - Tours");
                                                                        Tours();
                                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowSwitch");
                                                                        FlowSwitch();
                                                                    }
                                                                    break;
                                                            }
                                                        }
                                                        NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowWhile");
                                                        FlowWhile();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    NSDL2_RUNLOGIC(NULL, NULL, "Executing flow - FlowDoWhile");
                    FlowDoWhile();
                }
            } while(ns_get_int_val("var_dowhile"));
        }
    }

    NSDL2_RUNLOGIC(NULL, NULL, "Executing ns_exit_session()");
    ns_exit_session();
}