[omniORB] beginer getting ... very frustrated !

Philippe Moutarlier philippe@kscable.com
Sat, 27 Nov 1999 15:56:52 -0700



Hi,

I am pretty new to omniorb and even Corba ingeneral but the behaviour I experience  is frustrating for me. I am using omniorb 2.8.0 on a linux Redhat 6.1 machine.

Here is my pb : 

I have a very basic interface with 1 attribute (an array of 4 longs). If I call several times the Get method on this attribute, the first time is ok, then subsequent call seem to crash the first 2 values of the array. Here it is (the 1 is an option on the clienside for asking values ). note that I checked that the pb is not on the client side but rather on the server.


1
0 0 0 0 
1
1077338200 1077338200 0 0 
1
134622040 134622040 0 0 
1
134622040 134622040 0 0 
1
134622040 134622040 0 0 
1

Thanks for any help !!!

Philippe


Here is the interface :

typedef  long  arraySonarSet [4];
interface RobotState{
  
  attribute arraySonarSet SonarSet;
};





I implemented the class :

#include <string.h>
#include "robot.hh"

class RobotState_i;



class RobotState_i : public virtual _sk_RobotState {
public:
  arraySonarSet_slice * _SonarSet;
  CORBA::Long _a;
  RobotState_i() { _SonarSet = new arraySonarSet_slice;}
  virtual ~RobotState_i() {}

//here is the funny thing : calling many times this methods leads to 
// the first 2 values of _SonarSet to be crashed !!!
  virtual arraySonarSet_slice * SonarSet () {
    for(int i = 0 ; i < 4; i++)
      cout << _SonarSet[i] << " ";
    cout << endl;
    return _SonarSet;} 

  virtual void SonarSet(const arraySonarSet sonar_val){
    for(int i = 0 ; i < 4; i++)
      _SonarSet[i] = sonar_val[i];
  }
  
};