Previous: Defining Processor Object Types Up: Processor Objects Next: Using Processor Object Pointers
{ proc_t placement("pobj_Merger.out","fides"); Merger* global merger1 = new (placement) Merger(constructor-arguments) }
The placement argument must be of type proc_t. proc_t is an implementation-defined type that specifies where to place a processor object and where to find its definition. In our implementation of CC++, proc_t contains two fields: an executable name and a machine name. The executable name states where the definition of the processor object can be found, and the machine name states on what machine that processor object should be created.
The interface to type proc_t is as follows:
class proc_t { public: char* host_name; char* executable_path; proc_t(); proc_t(); proc_t (const proc_t &); proc_t (char* executable,char* host); proc_t & operator=(const proc_t &); };
When creating a processor object, CC++ checks that the type assigned to the executable given in the proc_t matches the type of the processor object being created. If these do not match, a run-time error occurs. For example, we get a run-time error with this piece of code:
{ proc_t placement("pobj_Sorter.out","fides"); Merger *global merger = new (placement) Merger(constructor-arguments); }
The type assigned to pobj_Sorter.out was Sorter, while the allocation statement is creating an object of type Merger. The call to new returns a global pointer to the newly created processor object.