Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2007
MikeGerdes MikeGerdes is offline
Registered User
 
Name: Mike Gerdes
Organization: TU hamburg-Harburg
Project: Tree Structure
 
Join Date: Feb 2007
Posts: 8
Pointers and Proxies

Hi,

I want to make a system with a tree structure that constits of nodes. These nodes have a parent and several children. And I use C++.

The slice description looks like this:

module structure {

sequence<Node> NodeSeq;

interface Node {

void setParent(string);
Node getParent();
NodeSeq getChildren();
}
}

The nodes have internally a vector where the child nodes are saved and a variable where the parent is set. SetParent is called from the parent of a node with the indentifier of the parent node. All nodes know only their children from a configuration file.

That is the setup. Now to my problem.

When I generate the C++ files from the Slice file, getParent returns a NodePtr and getChildren a vector of NodePtr.
When setParten gets called, a child resolves the given identifier and creates a proxy to his parten, so that he can call methodes there. The same happens for his children.

But how do I transform now the NodePrx objects into NodePtr objects? And is it possible that pointers point to remote objects and can I call methodes there? I have thried this setup in CORBA before, there there I simply used _var pointers, to call remote functions and for return values.

I have found no solution to my problem in the Ice book and in the examples. Have I overread something or am I doing it totally wrong?
Reply With Quote
  #2 (permalink)  
Old 02-07-2007
hiasl hiasl is offline
Registered User
 
Name: Matthias Weber
Organization: University of Erlangen-Nuremberg
Project: This baby is still nameless
 
Join Date: Jul 2005
Posts: 23
Hi Mike,

you could try to use asterixes. Then you get "remote references" to your nodes. We use a similar interface to access remote trees.

module structure {

sequence<Node *> NodeSeq;

interface Node {

void setParent(Node *);
Node *getParent();
NodeSeq getChildren();
}
}

Bye
Matthias
Reply With Quote
  #3 (permalink)  
Old 02-07-2007
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
As Matthias writes above, you have to use Node* for proxies, not Node . Have a look at "4.11.11 Pass-by-Value Versus Pass-by-Reference" in the Ice manual for more details.
Reply With Quote
  #4 (permalink)  
Old 02-07-2007
davidcr1983 davidcr1983 is offline
Registered User
 
Name: David Vallejo Fernández
Organization: Universidad de Castilla-La Mancha
Project: basic-fipa-multiagentsystem
 
Join Date: Jul 2005
Location: Ciudad Real (Spain)
Posts: 41
Hello!

You are confusing classes with interfaces. You should study the Simple File System exposed in the Ice documentation because is similar to your problem. In addition, it seems your application must be persistent... Freeze is the solution.

Regards!
__________________
Full name: David Vallejo Fernández
University of Castilla-La Mancha (Spain)
ICE Project: basic-fipa-multiagentsystem
Reply With Quote
  #5 (permalink)  
Old 02-07-2007
MikeGerdes MikeGerdes is offline
Registered User
 
Name: Mike Gerdes
Organization: TU hamburg-Harburg
Project: Tree Structure
 
Join Date: Feb 2007
Posts: 8
Oh I see, so I need to know if the object will be a remote or a local reference, when I design the Slice file.

I looked at the simple file server example, but there they never used a function that returns a remote reference, so I was a bit confused.

Many thanks, I will try it and let you know if I encounter any other problems.
Reply With Quote
  #6 (permalink)  
Old 02-07-2007
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Quote:
Originally Posted by MikeGerdes View Post
Oh I see, so I need to know if the object will be a remote or a local reference, when I design the Slice file.
You can use proxies, regardless of whether the Ice object is local or remote. This is completely transparent. The difference between Foo* and Foo has nothing to do with local vs. remote, but simply that in one case, you pass by proxy, while in the other case, you pass by value.

(We try to avoid the term "reference" because it has so many possible meanings.)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Different kinds of proxies mwilson Help Center 5 09-09-2005 01:06 PM
Smart pointers and proxys TraxTech Help Center 1 04-04-2005 06:56 PM
Problem with smart pointers galbe Help Center 2 06-22-2004 06:22 AM
SegFault problems with Proxies galbe Help Center 5 11-03-2003 09:55 AM
Objects and Proxies ganzuoni Help Center 1 06-18-2003 03:49 PM


All times are GMT -4. The time now is 01:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.