Results 1 to 3 of 3

Thread: Objects as argument ?

  1. #1
    ChMeessen is offline Registered User
    Join Date
    Sep 2003
    Location
    Marseille
    Posts
    11

    Question Objects as argument ?

    Hello,

    from the documentation I see that objects can be passed as argument.
    Since the client was generated using the Slice definition this should work. But what if the servant has referenced a derived class the client does not know about ?

    What is sent to the client ? What does it instantiate ? Does it throw an exception ?


    It would be ok if only structures without methods would be passed along. If the servant had a derived class it would only copy the struct corresponding to the argument type.


    Passing objects is a nice and desirable feature but I think it is also problematic since we can't send methods.

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    For classes with operations, you must install an object factory. Have a look at demo/Ice/value for an example.

  3. #3
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055

    Re: Objects as argument ?

    Originally posted by ChMeessen
    Hello,

    from the documentation I see that objects can be passed as argument.
    Since the client was generated using the Slice definition this should work. But what if the servant has referenced a derived class the client does not know about ?

    What is sent to the client ? What does it instantiate ? Does it throw an exception ?
    If a class has operations, it is abstract and you need to install a factory for the concrete type of the class (or, at least, a factory for one of the base types of the class). If a class has only data members and no operations, the class is concrete and does not require a factory.

    If the sender sends a class instance that is more derived than the formal type and the receiver does not have static knowledge of the actual run-time type of the instance, the instance is sliced to the most derived type that the receiver understands. The value demo in the Ice distribution illustrates this.

    Cheers,

    Michi.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Invalid argument socket error on HP-UX
    By tctimmeh in forum Help Center
    Replies: 4
    Last Post: 08-22-2008, 12:58 PM
  2. Replies: 13
    Last Post: 05-08-2008, 08:38 AM
  3. socket exception: Invalid argument
    By xorax in forum Help Center
    Replies: 2
    Last Post: 10-24-2007, 04:54 AM
  4. Replies: 1
    Last Post: 04-13-2007, 09:49 PM
  5. Replies: 1
    Last Post: 12-14-2005, 04:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •