// file: $isip/doc/examples/class/mmedia/mmedia_example_08/example.cc // // isip include files // #include #include // this example demonstrates how to use the Machine object // int main(int argc, const char** argv) { // declare Machine objects // String tmp_str; Machine mach_00; // verify the protocol methods // if (!mach_00.setProtocol(Machine::REMOTE_SHELL)) { Console::put(L"invalid Machine\n"); } if (mach_00.getProtocol() != Machine::REMOTE_SHELL) { Console::put(L"invalid Machine\n"); } // verify set the node name methods // tmp_str.assign(L"isip004"); if (!mach_00.setNodeName(tmp_str)) { Console::put(L"invalid Machine\n"); } if (!mach_00.getNodeName().eq(tmp_str)) { Console::put(L"invalid Machine\n"); } // verify the architecture methods // tmp_str.assign(L"sparc"); if (!mach_00.setArchitecture(tmp_str)) { Console::put(L"invalid Machine\n"); } if (!mach_00.getArchitecture().eq(tmp_str)) { Console::put(L"invalid Machine\n"); } // verify the num processors methods // if (!mach_00.setNumProcessors(2)) { Console::put(L"invalid Machine\n"); } if (mach_00.getNumProcessors() != 2) { Console::put(L"invalid Machine\n"); } // verify the processor speed methods // VectorDouble speed_00(2); speed_00(0) = 8.0e9; speed_00(1) = 1.0e12; if (!mach_00.setProcessorSpeed(speed_00)) { Console::put(L"invalid Machine\n"); } if (!mach_00.getProcessorSpeed().eq(speed_00)) { Console::put(L"invalid Machine\n"); } // verify the main memory methods // if (!mach_00.setMainMemory(8.0e8)) { Console::put(L"invalid Machine\n"); } if (!Integral::almostEqual(mach_00.getMainMemory(), 8.0e8)) { Console::put(L"invalid Machine\n"); } // verify the swap memory methods // if (!mach_00.setSwapMemory(800e6)) { Console::put(L"invalid Machine\n"); } if (!Integral::almostEqual(mach_00.getSwapMemory(), 8.0e8)) { Console::put(L"invalid Machine\n"); } // verify the OS methods // tmp_str.assign(L"solaris"); if (!mach_00.setOS(tmp_str)) { Console::put(L"invalid Machine\n"); } if (!mach_00.getOS().eq(tmp_str)) { Console::put(L"invalid Machine\n"); } // verify the OS version methods // tmp_str.assign(L"7.0"); if (!mach_00.setOSVersion(tmp_str)) { Console::put(L"invalid Machine\n"); } if (!mach_00.getOSVersion().eq(tmp_str)) { Console::put(L"invalid Machine\n"); } // exit gracefully // Integral::exit(); }