Cykliczna zależność w plikach IDL (CORBA)

0

Pytałem na stackoverflowie ale co dziwne nikt mi nie odpowiedział, więc może tutaj ktoś coś podpowie. Mam 2 pliki *.IDL i mam cykliczną zależność w obu:

#ifndef __USER_IDL__
#define __USER_IDL__

#include "Group.idl"

interface User
{
    typedef<sequence> Groups;
        Groups getGroups(); 
    void setGroups(in Groups u);
};

#endif
#ifndef __GROUP_IDL__
#define __GROUP_IDL__

#include "User.idl"

interface Group
{
    typedef<sequence> Users;
        Users getUser();    
    void setUsers(in Users u);
};

#endif

Całość : http://www32.zippyshare.com/v/32255598/file.html (z Makefilem, wystarczy dać make all), używam OmniORBa dla C++ tak btw.

Dostaję błędy przez te includy jak mniemam:

omniidl -bcxx User.idl Group.idl Syntax error in interface body Group.idl Error in look-up of 'Users': 'Users' not found Group.idl Error in look-up of 'Users': 'Users' not found Group.idl Error in look-up of 'Users': 'Users' not found User.idl Syntax error in interface body User.idl Error in look-up of 'Groups': 'Groups' not found User.idl Error in look-up of 'Groups': 'Groups' not found User.idl Error in look-up of 'Groups': 'Groups' not found omniidl: 8 errors.

Jak to rozwiązać?

0

W zwykłym C++ rozwiązałbyś to deklaracja zapowiadającą, więc może tutaj też? :)

0

Nie wiem, czemu o tym nie pomyślałem ... w każdym razie teraz wygląda to tak mniej więcej:

USER.IDL:

#ifndef __USER_IDL__
#define __USER_IDL__

interface Group;

interface User
{

	typedef sequence <Group> Groups;
    	Groups getGroups();	
	void setGroups(in Groups u);
};

#endif

GROUP.IDL:

#ifndef __GROUP_IDL__
#define __GROUP_IDL__

#include "User.idl"

interface Group
{
	typedef sequence <User> Users;
    	Users getUser();	
	void setUsers(in Users u);
};

#endif

Tylko niepokoi mnie ten warninig - niby to warning i wygląda na to, że niepoważny (bo w sumie ja przecież wiem, że mam ten interfejs Group), ale jednak mnie martwi - czy mam się o co martwić?

Mój uroczy warning:

omniidl -bcxx User.idl
User.idl Warning: Forward declared interface 'Group' was never fully defined
omniidl: 1 warning.
omniidl -bcxx Group.idl

0

No ale czemu nie masz

#include "Group.idl"

w User.idl skoro korzystasz z Group?

0

no jak dam #include "Group.idl" to mam niestety cykliczną zależność ...

0

Ma ktoś jakiś inny pomysł?

0

A pokaż jak dodałeś ten include, bo coś mi się nie chce wierzyć ze masz krzyżową zalezność jeśli include jest pod strażnikiem nagłówka.

1 użytkowników online, w tym zalogowanych: 0, gości: 1