Beispiel #1
0
int main()
{
	{
		Sorcerer	robert("Robert", "the Magnificient");
		
		Victim		jim("Jimmy");
		Peon		joe("Joe");
		
		std::cout << robert << jim << joe;
		
		robert.polymorph(jim);
		robert.polymorph(joe);
	}
	{
		Victim joe("Joe");
		Victim sarah = joe;
		Victim bob(sarah);

		std::cout << joe << sarah << bob;
		joe.getPolymorphed();
		sarah.getPolymorphed();
		bob.getPolymorphed();

		Peon pepe("Pepe");
		Peon carl = pepe;
		Peon martin(carl);
		Victim bobby = martin;
		Victim sar(carl);

		std::cout << pepe << carl << martin << bobby << sar;
	}
	return 0;
}
Beispiel #2
0
int main()
{
	Sorcerer robert("Robert", "the Magnificent");
	Victim jim("Jimmy");
	Peon joe("Joe");

	std::cout << robert << jim << joe;
	robert.polymorph(jim);
	robert.polymorph(joe);

	std::cout << std::endl << "+++++++++Extra TEXTS+++++++++" << std::endl << std::endl;
	Victim matt("Matt");
	Peon ben("Ben");
	Victim *Super_Jim = new Peon("Super_Jim");//
	std::cout << robert << matt << ben;//
	std::cout << *Super_Jim;//

	std::cout << std::endl << "+++++++++ matt = ben +++++++++" << std::endl << std::endl;
	matt = ben;//

	std::cout << robert << matt << ben;//
	robert.polymorph(matt);//
	robert.polymorph(ben);//
	robert.polymorph(*Super_Jim);//
	delete Super_Jim;
	return 0;
}
Beispiel #3
0
int main()
{
   fred();
   joe();
   henry();

   return 0;
}
Beispiel #4
0
void	sujet(void)
{
	Sorcerer robert("Robert", "the Magnificent");
	Victim jim("Jimmy'");
	Peon joe("Joe");
	std::cout << robert << jim << joe;
	robert.polymorph(jim);
	robert.polymorph(joe);
}
Beispiel #5
0
int	main() {
	Sorcerer robert("Robert", "the Magnificent");
	Victim jim("Jimmy");
	Peon joe("Joe");
	std::cout << robert << jim << joe;
	robert.polymorph(jim);
	robert.polymorph(joe);

	return (0);
}
Beispiel #6
0
// Allows for activating menu actions from anywhere in PCSX2.
// And it's Thread Safe!
void Pcsx2App::PostMenuAction( MenuIdentifiers menu_id ) const
{
	MainEmuFrame* mainFrame = GetMainFramePtr();
	if( mainFrame == NULL ) return;

	wxCommandEvent joe( wxEVT_COMMAND_MENU_SELECTED, menu_id );
	if( wxThread::IsMain() )
		mainFrame->GetEventHandler()->ProcessEvent( joe );
	else
		mainFrame->GetEventHandler()->AddPendingEvent( joe );
}
Beispiel #7
0
int main (void)
{
	// Note that we can say that an Employee is not necessarily
	// a Manager, but a Manager is an Employee (this is inheritance!!!)
	Employee joe("joe", 5.67, 3.5);
	Manager bill("bill", 2000.00, 55, true);

	cout << "Employee Joe: " << joe.calculatePay () << endl;
	cout << "Manager bill: " << bill.calculatePay () << endl;

	return 0;
}
int main(int, const char * []) {
    IloEnv env;
    try {
        IloInt i,j;
        IloModel model(env);

        IloNumExpr cost(env);
        IloIntervalVarArray allTasks(env);
        IloIntervalVarArray joeTasks(env);
        IloIntervalVarArray jimTasks(env);
        IloIntArray joeLocations(env);
        IloIntArray jimLocations(env);

        MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations,
                  jimLocations, 0, 0,   120, 100.0);
        MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations,
                  jimLocations, 1, 0,   212, 100.0);
        MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations,
                  jimLocations, 2, 151, 304, 100.0);
        MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations,
                  jimLocations, 3, 59,  181, 200.0);
        MakeHouse(model, cost, allTasks, joeTasks, jimTasks, joeLocations,
                  jimLocations, 4, 243, 425, 100.0);

        IloTransitionDistance tt(env, 5);
        for (i=0; i<5; ++i)
            for (j=0; j<5; ++j)
                tt.setValue(i, j, IloAbs(i-j));

        IloIntervalSequenceVar joe(env, joeTasks, joeLocations, "Joe");
        IloIntervalSequenceVar jim(env, jimTasks, jimLocations, "Jim");

        model.add(IloNoOverlap(env, joe, tt));
        model.add(IloNoOverlap(env, jim, tt));

        model.add(IloMinimize(env, cost));

        /* EXTRACTING THE MODEL AND SOLVING. */
        IloCP cp(model);
        if (cp.solve()) {
            cp.out() << "Solution with objective " << cp.getObjValue() << ":" << std::endl;
            for (i=0; i<allTasks.getSize(); ++i) {
                cp.out() << cp.domain(allTasks[i]) << std::endl;
            }
        } else {
            cp.out() << "No solution found. " << std::endl;
        }
    } catch (IloException& ex) {
        env.out() << "Error: " << ex << std::endl;
    }
    env.end();
    return 0;
}
Beispiel #9
0
// Internal use state loading function which does not trap exceptions.
// The calling function should trap ahnd handle exceptions as needed.
static void _loadStateOrExcept( const string& file )
{
	gzLoadingState joe( file );		// this'll throw an StateLoadError_Recoverable.

	// Make sure the cpu and plugins are ready to be state-ified!
	cpuReset();
	OpenPlugins( NULL );

	joe.FreezeAll();

	if( GSsetGameCRC != NULL )
		GSsetGameCRC(ElfCRC, g_ZeroGSOptions);
}
TEST_F(BaseAttributesTest, CanBeInitializedViaAttributePairs) {
  Person joe(
    attribute_pairs
      ("age", 45)
      ("name", "Joe")
      ("surname", "Yates")
      ("height", 1.80)
      ("dob", Date(1965, 7, 31))
  );

  ASSERT_EQ(45,                       joe.integer("age"));
  assert_string("Joe",                joe.text("name"));
  ASSERT_DOUBLE_EQ(1.80,              joe.floating_point("height"));
  assert_attribute(Date(1965, 7, 31), joe.date("dob"));
}
Beispiel #11
0
int main()
{
	Employee joe("Joe", "Butcher");
	Friend john("John");
	std::vector<Person> people;
	people.push_back(joe);
	people.push_back(john);

	int n = people.size();

	for (int i = 0; i < n; i++) {
		people[i].Print();
	}


	// design flaw is that it will call upon the Base::Function() as opposed to the Derived::Function()

	
}
Beispiel #12
0
int main()
{
	Sorcerer robert("Robert", "the Magnificent");
	Victim jim("Jimmy");
	Peon joe("Joe");
	std::cout << robert << jim << joe;
	robert.polymorph(jim);
	robert.polymorph(joe);
	std::cout << std::endl;

	Perifalk henri("Henri");
	std::cout << henri;
	robert.polymorph(henri);
	std::cout << std::endl;

	Peon copy(joe);
	Peon copy2("Franck");
	copy2 = copy;
	std::cout << std::endl;

	return 0;
}
Beispiel #13
0
int Factory::run() {
    Dispatcher joe(aLineList, length_aLineList );
    joe.dispatch(&packageBufferQ, pkgCount );
    return 0;
}
Beispiel #14
0
// ------------------------------------------------------------------------
MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
	: wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) )

	, m_statusbar( *CreateStatusBar(2, 0) )
	, m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() )

	// All menu components must be created on the heap!

	, m_menubar( *new wxMenuBar() )

	, m_menuCDVD	( *new wxMenu() )
	, m_menuSys		( *new wxMenu() )
	, m_menuConfig	( *new wxMenu() )
	, m_menuMisc	( *new wxMenu() )
	, m_menuDebug	( *new wxMenu() )

	, m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) )
	, m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) )

	, m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, _("Show Console"), wxEmptyString, wxITEM_CHECK ) )
	, m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, _("Console to Stdio"), wxEmptyString, wxITEM_CHECK ) )

{
	m_RestartEmuOnDelete = false;

	for( int i=0; i<PluginId_Count; ++i )
		m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i );

	// ------------------------------------------------------------------------
	// Initial menubar setup.  This needs to be done first so that the menu bar's visible size
	// can be factored into the window size (which ends up being background+status+menus)

	//m_menubar.Append( &m_menuBoot,		_("&Boot") );
	m_menubar.Append( &m_menuSys,		_("&System") );
	m_menubar.Append( &m_menuCDVD,		_("CD&VD") );
	m_menubar.Append( &m_menuConfig,	_("&Config") );
	m_menubar.Append( &m_menuMisc,		_("&Misc") );
#ifdef PCSX2_DEVBUILD
	m_menubar.Append( &m_menuDebug,		_("&Debug") );
#endif
	SetMenuBar( &m_menubar );

	// ------------------------------------------------------------------------

	wxSize backsize( m_background.GetSize() );

	wxString wintitle;
	if( PCSX2_isReleaseVersion )
	{
		// stable releases, with a simple title.
		wintitle.Printf( _("%s  %d.%d.%d %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
			SVN_MODS ? _("(modded)") : wxEmptyString
		);
	}
	else
	{
		// beta / development editions, which feature revision number and compile date.
		wintitle.Printf( _("%s  %d.%d.%d.%d%s (svn)  %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo,
			SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() );
	}

	SetTitle( wintitle );

	// Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and
	// loses the transparency information when loading bitmaps into icons.  But for some reason
	// I cannot get it to work despite following various examples to the letter.


	SetIcons( wxGetApp().GetIconBundle() );

	int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) };
	m_statusbar.SetStatusWidths(2, m_statusbar_widths);
	//m_statusbar.SetStatusText( L"The Status is Good!", 0);
	m_statusbar.SetStatusText( wxEmptyString, 0);

	wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) );
	joe.Add( &m_background );
	SetSizerAndFit( &joe );

	// Use default window position if the configured windowpos is invalid (partially offscreen)
	if( g_Conf->MainGuiPosition == wxDefaultPosition || !pxIsValidWindowPosition( *this, g_Conf->MainGuiPosition) )
		g_Conf->MainGuiPosition = GetScreenPosition();
	else
		SetPosition( g_Conf->MainGuiPosition );

	// Updating console log positions after the main window has been fitted to its sizer ensures
	// proper docked positioning, since the main window's size is invalid until after the sizer
	// has been set/fit.

	InitLogBoxPosition( g_Conf->ProgLogBox );

	// ------------------------------------------------------------------------
	// Some of the items in the System menu are configured by the UpdateCoreStatus() method.
	
	m_menuSys.Append(MenuId_Boot_CDVD,		_("Initializing..."));

	m_menuSys.Append(MenuId_Boot_CDVD2,		_("Initializing..."));

	m_menuSys.Append(MenuId_Boot_ELF,		_("Run ELF..."),
		_("For running raw PS2 binaries directly"));

	m_menuSys.AppendSeparator();
	m_menuSys.Append(MenuId_Sys_SuspendResume,	_("Initializing..."));
	m_menuSys.AppendSeparator();

	//m_menuSys.Append(MenuId_Sys_Close,		_("Close"),
	//	_("Stops emulation and closes the GS window."));

	m_menuSys.Append(MenuId_Sys_LoadStates,	_("Load state"), &m_LoadStatesSubmenu);
	m_menuSys.Append(MenuId_Sys_SaveStates,	_("Save state"), &m_SaveStatesSubmenu);

	m_menuSys.Append(MenuId_EnableBackupStates,	_("Backup before save"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.AppendSeparator();

	m_menuSys.Append(MenuId_EnablePatches,	_("Automatic Gamefixes"),
		_("Automatically applies needed Gamefixes to known problematic games"), wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableCheats,	_("Enable Cheats"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableWideScreenPatches,	_("Enable Widescreen Patches"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.Append(MenuId_EnableHostFs,	_("Enable Host Filesystem"),
		wxEmptyString, wxITEM_CHECK);

	m_menuSys.AppendSeparator();

	m_menuSys.Append(MenuId_Sys_Shutdown,	_("Shutdown"),
		_("Wipes all internal VM states and shuts down plugins."));

	m_menuSys.Append(MenuId_Exit,			_("Exit"),
		AddAppName(_("Closing %s may be hazardous to your health")));


	// ------------------------------------------------------------------------
	wxMenu& isoRecents( wxGetApp().GetRecentIsoMenu() );

	//m_menuCDVD.AppendSeparator();
	m_menuCDVD.Append( MenuId_IsoSelector,	_("Iso Selector"), &isoRecents );
	m_menuCDVD.Append( GetPluginMenuId_Settings(PluginId_CDVD), _("Plugin Menu"), m_PluginMenuPacks[PluginId_CDVD] );

	m_menuCDVD.AppendSeparator();
	m_menuCDVD.Append( MenuId_Src_Iso,		_("Iso"),		_("Makes the specified ISO image the CDVD source."), wxITEM_RADIO );
	m_menuCDVD.Append( MenuId_Src_Plugin,	_("Plugin"),	_("Uses an external plugin as the CDVD source."), wxITEM_RADIO );
	m_menuCDVD.Append( MenuId_Src_NoDisc,	_("No disc"),	_("Use this to boot into your virtual PS2's BIOS configuration."), wxITEM_RADIO );

	//m_menuCDVD.AppendSeparator();
	//m_menuCDVD.Append( MenuId_SkipBiosToggle,_("Enable BOOT2 injection"),
	//	_("Skips PS2 splash screens when booting from Iso or DVD media"), wxITEM_CHECK );

	// ------------------------------------------------------------------------

	m_menuConfig.Append(MenuId_Config_SysSettings,	_("Emulation &Settings") );
	m_menuConfig.Append(MenuId_Config_McdSettings,	_("&Memory cards") );
	m_menuConfig.Append(MenuId_Config_BIOS,			_("&Plugin/BIOS Selector") );
	if (IsDebugBuild) m_menuConfig.Append(MenuId_Config_GameDatabase,	_("Game Database Editor") );
	// Empty menu
	// m_menuConfig.Append(MenuId_Config_Language,		_("Appearance...") );

	m_menuConfig.AppendSeparator();

	m_menuConfig.Append(MenuId_Config_GS,		_("&Video (GS)"),		m_PluginMenuPacks[PluginId_GS]);
	m_menuConfig.Append(MenuId_Config_SPU2,		_("&Audio (SPU2)"),		m_PluginMenuPacks[PluginId_SPU2]);
	m_menuConfig.Append(MenuId_Config_PAD,		_("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]);
	m_menuConfig.Append(MenuId_Config_DEV9,		_("Dev9"),				m_PluginMenuPacks[PluginId_DEV9]);
	m_menuConfig.Append(MenuId_Config_USB,		_("USB"),				m_PluginMenuPacks[PluginId_USB]);
	m_menuConfig.Append(MenuId_Config_FireWire,	_("Firewire"),			m_PluginMenuPacks[PluginId_FW]);

	//m_menuConfig.AppendSeparator();
	//m_menuConfig.Append(MenuId_Config_Patches,	_("Patches (unimplemented)"),	wxEmptyString);

	m_menuConfig.AppendSeparator();
	m_menuConfig.Append(MenuId_Config_Multitap0Toggle,	_("Multitap 1"),	wxEmptyString, wxITEM_CHECK );
	m_menuConfig.Append(MenuId_Config_Multitap1Toggle,	_("Multitap 2"),	wxEmptyString, wxITEM_CHECK );

	m_menuConfig.AppendSeparator();
	m_menuConfig.Append(MenuId_Config_ResetAll,	_("Clear all settings..."),
		AddAppName(_("Clears all %s settings and re-runs the startup wizard.")));

	// ------------------------------------------------------------------------

	m_menuMisc.Append( &m_MenuItem_Console );
#ifdef __LINUX__
	m_menuMisc.Append( &m_MenuItem_Console_Stdio );
#endif
	//Todo: Though not many people need this one :p
	//m_menuMisc.Append(MenuId_Profiler,			_("Show Profiler"),	wxEmptyString, wxITEM_CHECK);
	//m_menuMisc.AppendSeparator();

	// No dialogs implemented for these yet...
	//m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL);
	//m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL);

	m_menuMisc.AppendSeparator();

	//Todo:
	//There's a great working "open website" in the about panel. Less clutter by just using that.
	//m_menuMisc.Append(MenuId_Website,			_("Visit Website..."),
	//	_("Opens your web-browser to our favorite website."));
	m_menuMisc.Append(MenuId_About,				_("About...") );

	m_menuMisc.AppendSeparator();
	m_menuMisc.Append( MenuId_ChangeLang,		L"Change Language" ); // Always in English

#ifdef PCSX2_DEVBUILD
	//m_menuDebug.Append(MenuId_Debug_Open,		_("Open Debug Window..."),	wxEmptyString);
	//m_menuDebug.Append(MenuId_Debug_MemoryDump,	_("Memory Dump..."),		wxEmptyString);
	m_menuDebug.Append(MenuId_Debug_Logging,	_("Logging..."),			wxEmptyString);
#endif
	m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible );

	ConnectMenus();
	Connect( wxEVT_MOVE,			wxMoveEventHandler			(MainEmuFrame::OnMoveAround) );
	Connect( wxEVT_CLOSE_WINDOW,	wxCloseEventHandler			(MainEmuFrame::OnCloseWindow) );
	Connect( wxEVT_SET_FOCUS,		wxFocusEventHandler			(MainEmuFrame::OnFocus) );
	Connect( wxEVT_ACTIVATE,		wxActivateEventHandler		(MainEmuFrame::OnActivate) );

	PushEventHandler( &wxGetApp().GetRecentIsoManager() );
	SetDropTarget( new IsoDropTarget( this ) );

	ApplyCoreStatus();
	ApplySettings();
}
int main()
{
	Employee joe("Joe", "Butcher");
	joe.Print();
	
}
Beispiel #16
0
/* structures and arrays of type t, need to be marked if their
   bodies are not write protected even if the headers are.
   So we should keep these on pages particular to them.
   Actually we will change structure sets to touch the structure
   header, that way we won't have to keep the headers in memory.
   This takes only 1.47 as opposed to 1.33 microseconds per set.
*/
static void
sgc_mark_object1(object x) {

  fixnum i,j;
  object *p;
  void *cp;
  enum type tp;
  
  cs_check(x);

  if (cstack_dir==-1 ? mcsl>(void *)&cp : mcsl<(void *)&cp)
    mcsl=&cp;

 BEGIN:
#ifdef SDEBUG
  if (x == OBJNULL || !ON_WRITABLE_PAGE(x))
    return;
  IF_WRITABLE(x,goto OK);
  joe();
 OK:
#endif 
  if (is_marked_or_free(x))
    return;
#ifdef SDEBUG
  if(x==sdebug) joe1();
#endif
  
  tp=type_of(x);

  if (tp==t_cons) {
    sgc_mark_cons(x);
    return;
  }

  mark(x);

  switch (tp) {

  case t_fixnum:
    break;
    
  case t_ratio:
    sgc_mark_object(x->rat.rat_num);
    x = x->rat.rat_den;
    IF_WRITABLE(x,if(!is_marked_or_free(x)) goto BEGIN);
    
  case t_shortfloat:
    break;
    
  case t_longfloat:
    break;
    
  case t_complex:
    sgc_mark_object(x->cmp.cmp_imag);
    x = x->cmp.cmp_real;
    IF_WRITABLE(x,if(!is_marked_or_free(x)) goto BEGIN);
    
  case t_character:
    break;
    
  case t_symbol:
    IF_WRITABLE(x->s.s_plist,if(!is_marked_or_free(x->s.s_plist))
    {/* mark(x->s.s_plist); */
    sgc_mark_cons(x->s.s_plist);});