% Remember to use the lgrind style \File{structure.cc},{12:09},{Oct 24 1996} \L{\LB{\K{\#include}_\S{}\"packers.hh\"\SE{}____________________\1\1_\V{Include}_\V{the}_\V{header}_\V{definition}_\K{for}}} \L{\LB{_________________________________________\1\1__\V{the}_\V{common}_\V{interface}_\V{declaration}}} \L{\LB{_________________________________________\1\1__\K{for}_\V{the}_\V{distributed}_\V{class}}} \L{\LB{\K{\#include}_\S{}\"Buffer.h\"\SE{}______________________\1\1_\V{Provide}_\V{Support}_\K{for}_\V{Buffer}_\V{Class}}} \L{\LB{\K{\#include}_\<\V{iostream}.\V{h}\>____________________\1\1_\V{Provide}_\V{Support}_\K{for}_\V{IO}_\V{handling}_}} \L{\LB{}} \L{\LB{\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1}} \L{\LB{\1\1\V{Function}:_\V{main}_____________________}} \L{\LB{\1\1\V{Author}:_\V{Dean}_\V{Thompson}______________}} \L{\LB{\1\1\V{Created}:_3rd_\V{August}_1996___________}} \L{\LB{\1\1\V{Last}_\V{Modified}:_4th_\V{October}_1996____}} \L{\LB{\1\1\V{Description}:__\V{This}_\V{routine}_\V{is}______}} \L{\LB{\1\1__\V{responsible}_\K{for}_\V{conducting}_\V{the}___}} \L{\LB{\1\1__\V{test}_\V{by}_\V{doing}_\V{the}_\V{following}:_____}} \L{\LB{\1\1___________________________________}} \L{\LB{\1\1____\*_\V{Creating}_\V{two}_\V{objects}_________}} \L{\LB{\1\1____\*_\V{Binding}_\V{to}_\V{two}_\V{servers}_______}} \L{\LB{\1\1____\*_\V{Setting}_\V{the}_\V{data}_\V{up}_\V{into}_\V{the}_}} \L{\LB{\1\1________\V{objects}____________________}} \L{\LB{\1\1____\*_\V{Passing}_\V{the}_\V{data}_\V{between}_\V{the}_}} \L{\LB{\1\1________\V{the}_\V{objects}_10,000_\V{times}___}} \L{\LB{\1\1____\*_\V{Print}_\V{the}_\V{contents}_\V{out}_\V{to}_\V{the}}} \L{\LB{\1\1________\V{screen}_____________________}} \L{\LB{\1\1___________________________________}} \L{\LB{\1\1____\*_(\V{Standard}_\V{Implementation})_____}} \L{\LB{\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1}} \L{\LB{}} \L{\LB{\K{int}_\V{main}()}} \L{\LB{\{}} \L{\LB{__\V{Packers\_var}_\V{aPackerVar},\V{bPackerVar};_____\1\1_\V{CORBA}_\V{variables}_\V{designed}_\V{to}_}} \L{\LB{_________________________________________\1\1__\V{manage}_\V{pointers}_\V{to}_\V{objects}_}} \L{\LB{_________________________________________\1\1__\V{which}_\V{are}_\S{}\"bound\"\SE{}_\V{to}_\V{a}_\V{server}}} \L{\LB{_}} \L{\LB{__\V{dataTransfer}_\V{aTransBuffer};_____________\1\1_\V{Declare}_\V{the}_\V{transfer}_\V{buffer}_\V{used}}} \L{\LB{_________________________________________\1\1__\V{to}_\V{pass}_\V{data}_\V{between}_\V{the}_\V{server}_}} \L{\LB{_________________________________________\1\1__\V{and}_\V{client}_\V{objects}}} \L{\LB{}} \L{\LB{__\V{dataTransfer}_\*\V{tempBuff};________________\1\1_\V{Declare}_\V{a}_\V{pointer}_\V{to}_\V{the}_\V{transfer}}} \L{\LB{_________________________________________\1\1__\V{buffer}_\V{to}_\V{allow}_\V{the}_\V{server}_\V{to}_\V{put}}} \L{\LB{_________________________________________\1\1__\V{data}_\V{into}_\V{it}_\V{via}_\V{the}_\V{memory}_}} \L{\LB{_________________________________________\1\1__\V{pointer}_}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aString}_=_\V{CORBA}::\V{string\_alloc}(80);}} \L{\LB{}} \L{\LB{_________________________________________\1\1_\V{Allocate}_\V{memory}_\K{for}_\V{the}_\V{character}}} \L{\LB{_________________________________________\1\1__\V{array}__}} \L{\LB{}} \L{\LB{__\V{aPackerVar}_=_\V{Packers}::\V{\_bind}();_________\1\1_\V{Make}_\V{contact}_\V{with}_\V{one}_\V{server}}} \L{\LB{__\V{bPackerVar}_=_\V{Packers}::\V{\_bind}(\S{}\":ObjectStore2\"\SE{},\S{}\"firefly.sd.monash.edu.au\"\SE{});}} \L{\LB{_________________________________________\1\1_\V{Make}_\V{contact}_\V{with}_\V{a}_\V{second}_\V{server}}} \L{\LB{_________________________________________\1\1__\V{located}_\V{on}_\S{}\"firefly.sd\"\SE{}_}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aLong}_=_\-2100000000;________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"long\"\SE{}_\V{variable}}} \L{\LB{__\V{aTransBuffer}.\V{bLong}_=_\-2100000000;}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aUnsignedLong}_=_4200000000;_\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"unsigned_long\"\SE{}}} \L{\LB{___________________________________________\1\1__\V{variable}}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aUnsignedShort}_=_65535;_____\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"unsigned_short\"\SE{}}} \L{\LB{___________________________________________\1\1__\V{variable}}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aFloat}_=_\-65545.57;_________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"float\"\SE{}_\V{variable}}} \L{\LB{__\V{aTransBuffer}.\V{bFloat}_=_\-65545.57;}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aDouble}_=_6000;_____________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"double\"\SE{}_\V{variable}}} \L{\LB{__\V{aTransBuffer}.\V{bDouble}_=_6000;}} \L{\LB{__\V{aTransBuffer}.\V{aCharacter}_=_\S{}\'M\'\SE{};___________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"character\"\SE{}_}} \L{\LB{___________________________________________\1\1__\V{variable}}} \L{\LB{}} \L{\LB{__\V{aTransBuffer}.\V{aBoolean}_=_1;_______________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"boolean\"\SE{}_\V{variable}}} \L{\LB{}} \L{\LB{__\V{strcpy}(\V{aTransBuffer}.\V{aString},\S{}\"_Data_Transfer_Test_for_Communications_Data.\,.\,.\,.\,.\,.\,.\,.\,.\"\SE{});}} \L{\LB{_________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"character_array\"\SE{}_\V{variable}__}} \L{\LB{}} \L{\LB{__\K{for}_(\K{int}_\V{i}=0;\V{i}\<10000;\V{i}++)________________\1\1_\V{Setting}_\V{up}_\V{the}_\V{looping}_\V{construct}}} \L{\LB{___________________________________________\1\1_\K{for}_10,000_\V{iterations}}} \L{\LB{____\{}} \L{\LB{______\V{try}__________________________________\1\1__\V{Make}_\V{all}_\V{the}_\V{CORBA}_\V{calls}_\V{with}}} \L{\LB{}\Tab{8}{___________________________________\1\1__\V{the}_\V{safety}_\V{of}_\V{a}_\S{}\"try\"\SE{}_\V{block}_\V{to}_}} \L{\LB{}\Tab{8}{___________________________________\1\1_\S{}\"catch\"\SE{}_\V{any}_\V{errors}}} \L{\LB{______\{}} \L{\LB{}\Tab{8}{\V{cout}_\<\<_\S{}\"Iteration_\#\"\SE{}_\<\<_\V{i}+1_\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{}\Tab{8}{___________________________________\1\1__\V{Report}_\V{the}_\V{number}_\V{of}_\V{the}}} \L{\LB{___}\Tab{8}{___________________________________\1\1__\V{iteration}_\V{we}_\V{are}_\V{currently}_\V{on}_}} \L{\LB{}\Tab{8}{}} \L{\LB{}\Tab{8}{\V{aTransBuffer}.\V{aShort}_=_\V{i}+1;_________\1\1_\V{Set}_\V{the}_\V{local}_\S{}\"short\"\SE{}_\V{variable}_\V{to}}} \L{\LB{}\Tab{8}{___________________________________\1\1__\V{the}_\V{current}_\V{iteration}}} \L{\LB{________\V{aTransBuffer}.\V{bShort}_=_\V{i}+1;}} \L{\LB{}} \L{\LB{}\Tab{8}{\V{aPackerVar}\-\!\>\V{defaultSaveStruct}(\V{aTransBuffer});}} \L{\LB{}\Tab{8}{___________________________________\1\1_\V{Send}_\V{the}_\V{data}_\V{structure}_\V{to}_\V{the}}} \L{\LB{}\Tab{8}{___________________________________\1\1__\V{remote}_\V{object}_\V{to}_\V{have}_\V{it}\S{}\'s_data_}} \L{\LB{}\Tab{8}{___________________________________\1\1__loaded}} \L{\LB{_}} \L{\LB{}\Tab{8}{aPackerVar\-\!\>defaultLoadStruct(tempBuff);}} \L{\LB{}\Tab{8}{___________________________________\1\1_Request_the_data_structure_back}} \L{\LB{_}\Tab{8}{___________________________________\1\1__from_the_first_object_in_a_}} \L{\LB{_}\Tab{8}{___________________________________\1\1__structure_format}} \L{\LB{_}} \L{\LB{}\Tab{8}{bPackerVar\-\!\>defaultSaveStruct(aTransBuffer);}} \L{\LB{___________________________________________\1\1_Transmit_the_same_data_to_the_}} \L{\LB{_}\Tab{8}{___________________________________\1\1__second_object_in_a_structure_}} \L{\LB{}\Tab{8}{___________________________________\1\1__format_}} \L{\LB{}} \L{\LB{_____\1\1_To_make_sure_that_the_data_was_sent_to_the_second_object_correctly}} \L{\LB{_____\1\1__the_client_request_all_that_data_to_be_sent_back_and_displayed_to_the}} \L{\LB{_____\1\1__screen}} \L{\LB{}} \L{\LB{_____cout_\<\<_\"Reconstructed_short:_\"_\<\<_bPackerVar\-\!\>aShort()_\<\<_\".\"_\<\<_endl;}} \L{\LB{______________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\K{short}}} \L{\LB{_}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_long:_\"\SE{}_\<\<_\V{bPackerVar}\-\!\>\V{aLong}()_\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{______________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_long}} \L{\LB{}} \L{\LB{_____cout_\<\<_\"Reconstructed_unsigned_short:_\"_\<\<_bPackerVar\-\!\>aUnsignedShort()_}} \L{\LB{__________\<\<_\".\"_\<\<_endl;}} \L{\LB{___________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\K{unsigned}_\K{short}_}} \L{\LB{}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_unsigned_long:_\"\SE{}_\<\<_\V{bPackerVar}\-\!\>\V{aUnsignedLong}()_}} \L{\LB{__________\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{___________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_unsigned_long}} \L{\LB{}} \L{\LB{_____cout_\<\<_\"Reconstructed_float:_\"_\<\<_bPackerVar\-\!\>aFloat()_\<\<_\".\"_\<\<_endl;}} \L{\LB{___________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\K{float}}} \L{\LB{}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_double:_\"\SE{}_\<\<_\V{bPackerVar}\-\!\>\V{aDouble}()_\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{___________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_double}} \L{\LB{_}} \L{\LB{_____cout_\<\<_\"Reconstructed_character:_\"_\<\<_(char)_bPackerVar\-\!\>aCharacter()_}} \L{\LB{__________\<\<_\".\"_\<\<_endl;}} \L{\LB{___________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\V{character}}} \L{\LB{}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_boolean:_\"\SE{}_\<\<_(\K{int})_\V{bPackerVar}\-\!\>\V{aBoolean}()_\<\<_\S{}\".\"\SE{}_}} \L{\LB{__________\<\<_\V{endl};}} \L{\LB{___________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_boolean}} \L{\LB{}} \L{\LB{_____bPackerVar\-\!\>aFloat();}} \L{\LB{_____bPackerVar\-\!\>aFloat();}} \L{\LB{______}} \L{\LB{_____cout_\<\<_\"Reconstructed_string:_\"_\<\<_bPackerVar\-\!\>aString()_\<\<_\".\"_}} \L{\LB{__________\<\<_endl;}} \L{\LB{___________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\V{string}_\V{after}_\V{it}_\V{was}}} \L{\LB{___________\1\1___\K{return}_\V{from}_\V{the}_\V{inital}_\V{object}}} \L{\LB{__}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_short:_\"\SE{}_\<\<_\V{bPackerVar}\-\!\>\V{bShort}()_\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{______________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_short}} \L{\LB{_}} \L{\LB{_____cout_\<\<_\"Reconstructed_long:_\"_\<\<_bPackerVar\-\!\>bLong()_\<\<_\".\"_\<\<_endl;}} \L{\LB{______________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\K{long}}} \L{\LB{}} \L{\LB{_____\V{cout}_\<\<_\S{}\"Reconstructed_float:_\"\SE{}_\<\<_\V{bPackerVar}\-\!\>\V{bFloat}()_\<\<_\S{}\".\"\SE{}_\<\<_\V{endl};}} \L{\LB{___________\1\1__\V{Display}_\V{the}_\V{value}_\V{of}_\V{the}_\V{remote}_\V{object}\S{}\'s_float}} \L{\LB{}} \L{\LB{_____cout_\<\<_\"Reconstructed_double:_\"_\<\<_bPackerVar\-\!\>bDouble()_\<\<_\".\"_\<\<_endl;}} \L{\LB{___________\1\1__Display_the_value_of_the_remote_object\'\SE{}\V{s}_\K{double}}} \L{\LB{_}} \L{\LB{_____\V{cout}_\<\<_\V{endl};}} \L{\LB{}} \L{\LB{______\}}} \L{\LB{_____\V{catch}(\V{CORBA}::\V{SystemException}_\&\V{se})___\1\1_\V{catch}_\V{any}_\V{CORBA}::\V{SystemException}}} \L{\LB{_____\{}} \L{\LB{}\Tab{8}{_\V{cout}_\<\<_\S{}\"Error\"\SE{}_\<\<_\&\V{se}_\<\<_\V{endl};____\1\1_\V{Display}_\V{the}_\V{data}_\V{about}_\V{the}_}} \L{\LB{____________________________________________\1\1__\V{associated}_\V{error}}} \L{\LB{}} \L{\LB{}\Tab{8}{_\K{return}_1;}} \L{\LB{_____\}}} \L{\LB{____\}}} \L{\LB{__\K{return}_0;}} \L{\LB{\}}} \L{\LB{}}