Exemplo n.º 1
0
int main (int argc, const char * argv[]) {
	// a bunch of json:
	char text1[]="{\n\"name\": \"Jack (\\\"Bee\\\") Nimble\", \n\"format\": {\"type\":       \"rect\", \n\"width\":      1920, \n\"height\":     1080, \n\"interlace\":  false,\"frame rate\": 24\n}\n}";	
	char text2[]="[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]";
	char text3[]="[\n    [0, -1, 0],\n    [1, 0, 0],\n    [0, 0, 1]\n	]\n";
	char text4[]="{\n		\"Image\": {\n			\"Width\":  800,\n			\"Height\": 600,\n			\"Title\":  \"View from 15th Floor\",\n			\"Thumbnail\": {\n				\"Url\":    \"http://www.example.com/image/481989943\",\n				\"Height\": 125,\n				\"Width\":  \"100\"\n			},\n			\"IDs\": [116, 943, 234, 38793]\n		}\n	}";
	char text5[]="[\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.7668,\n	 \"Longitude\": -122.3959,\n	 \"Address\":   \"\",\n	 \"City\":      \"SAN FRANCISCO\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94107\",\n	 \"Country\":   \"US\"\n	 },\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.371991,\n	 \"Longitude\": -122.026020,\n	 \"Address\":   \"\",\n	 \"City\":      \"SUNNYVALE\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94085\",\n	 \"Country\":   \"US\"\n	 }\n	 ]";

	// Process each json textblock by parsing, then rebuilding:
	doit(text1);
	doit(text2);	
	doit(text3);
	doit(text4);
	doit(text5);

	// Parse standard testfiles:
//	dofile("../../tests/test1");
//	dofile("../../tests/test2");
//	dofile("../../tests/test3");
//	dofile("../../tests/test4");
//	dofile("../../tests/test5");

	// Now some samplecode for building objects concisely:
	create_objects();
	
	return 0;
}
Exemplo n.º 2
0
int main(void)
{
    create_json_test();
    create_objects();

    return 0;
}
void RemoteServerProxyUpdater::handle_objects(GameInitMessage *message) {
  if (!new_level_) {
    update_objects(message);
  } else {
    create_objects(message);
    new_level_ = false;
  }
}
Exemplo n.º 4
0
FileThread::FileThread(File *file, int do_audio, int do_video)
 : Thread(1, 0, 0)
{
	reset();
	create_objects(file,
		do_audio,
		do_video);
}
Exemplo n.º 5
0
Arquivo: test.c Projeto: gatzka/cJSON
int main(void)
{
    /* print the version */
    printf("Version: %s\n", cJSON_Version());

    /* Now some samplecode for building objects concisely: */
    create_objects();

    return 0;
}
static void *
kaleidescope_init (Display *dpy, Window window)
{
  GLOBAL *g = (GLOBAL *) calloc (1, sizeof(*g));
  g->dpy = dpy;
  g->window = window;
  init_g (g);
  create_objects(g);
  init_objects (g);
  return g;
}
Exemplo n.º 7
0
int main (int argc, char **argv) {
	if ((argc != 1) && (argc != 2)) {
		fprintf(stderr, "ERROR: Invalid arguments!\n");
		fprintf(stderr, "Usage: %s [output_file]\n", argv[0]);
		return EXIT_FAILURE;
	}

	FILE *output_file = NULL;
	if ((argc == 2) && (argv[1] != NULL)) {
		output_file = fopen(argv[1], "w");
		if (output_file == NULL) {
			fprintf(stderr, "ERROR: Failed to open file '%s'\n", argv[1]);;
			return EXIT_FAILURE;
		}
	}

	/* a bunch of json: */
	char *json[] = {
		"{\n\"name\": \"Jack (\\\"Bee\\\") Nimble\", \n\"format\": {\"type\":       \"rect\", \n\"width\":      1920, \n\"height\":     1080, \n\"interlace\":  false,\"frame rate\": 24\n}\n}",

		"[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]",
		"[\n    [0, -1, 0],\n    [1, 0, 0],\n    [0, 0, 1]\n	]\n",
		"{\n		\"Image\": {\n			\"Width\":  800,\n			\"Height\": 600,\n			\"Title\":  \"View from 15th Floor\",\n			\"Thumbnail\": {\n				\"Url\":    \"http:/*www.example.com/image/481989943\",\n				\"Height\": 125,\n				\"Width\":  \"100\"\n			},\n			\"IDs\": [116, 943, 234, 38793]\n		}\n	}",
	"[\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.7668,\n	 \"Longitude\": -122.3959,\n	 \"Address\":   \"\",\n	 \"City\":      \"SAN FRANCISCO\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94107\",\n	 \"Country\":   \"US\"\n	 },\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.371991,\n	 \"Longitude\": -122.026020,\n	 \"Address\":   \"\",\n	 \"City\":      \"SUNNYVALE\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94085\",\n	 \"Country\":   \"US\"\n	 }\n	 ]"
	};

	/* Process each json textblock by parsing, then rebuilding: */
	for (size_t i = 0; i < (sizeof(json) / sizeof(char*)); i++) {
		buffer_create_with_existing_array(json_buffer, (unsigned char*)json[i], strlen(json[i]) + 1);
		int status = doit(json_buffer, output_file);
		if (status == 0) {
			fprintf(stderr, "ERROR: Failed on text %zu!\n", i);
			if (output_file != NULL) {
				fclose(output_file);
			}
			return EXIT_FAILURE;
		}
	}

	/* Now some samplecode for building objects concisely: */
	if (create_objects(output_file) != 0) {
		if (output_file != NULL) {
			fclose(output_file);
		}
		return EXIT_FAILURE;
	}

	if (output_file != NULL) {
		fclose(output_file);
	}

	return EXIT_SUCCESS;
}
Exemplo n.º 8
0
inline
void
field<oT>::init(const uword n_rows_in, const uword n_cols_in)
  {
  arma_extra_debug_sigprint( arma_boost::format("n_rows_in = %d, n_cols_in = %d") % n_rows_in % n_cols_in );
  
  const uword n_elem_new = n_rows_in * n_cols_in;

  if(n_elem == n_elem_new)
    {
    // delete_objects();
    // create_objects();
    access::rw(n_rows) = n_rows_in;
    access::rw(n_cols) = n_cols_in;
    }
  else
    {
    delete_objects();
    
    if(n_elem > sizeof(mem_local)/sizeof(oT*) )
      {
      delete [] mem;
      }
    
    if(n_elem_new <= sizeof(mem_local)/sizeof(oT*) )
      {
      mem = mem_local;
      }
    else
      {
      mem = new(std::nothrow) oT* [n_elem_new];
      arma_check_bad_alloc( (mem == 0), "field::init(): out of memory" );
      }
    
    access::rw(n_elem) = n_elem_new;
    
    if(n_elem_new == 0)
      {
      access::rw(n_rows) = 0;
      access::rw(n_cols) = 0;
      }
    else
      {
      access::rw(n_rows) = n_rows_in;
      access::rw(n_cols) = n_cols_in;
      }
    
    create_objects();
    
    }
  
  }
Exemplo n.º 9
0
int			check_food(t_server *s)
{
  clock_gettime(CLOCK_REALTIME, &s->now);
  if (s->next.tv_sec < s->now.tv_sec ||
      ((s->next.tv_sec == s->now.tv_sec) &&
       (s->next.tv_nsec <= s->now.tv_nsec)))
    {
      create_objects(s);
      decrement_food(s);
      new_ultimatum(s);
    }
  return (SUCCESS);
}
Exemplo n.º 10
0
int cjson_test(void)
{
     /* a bunch of json: */
     doit(text1);
     doit(text2);
     doit(text3);
     doit(text4);
     doit(text5);
     doit(text6);
    /* Now some samplecode for building objects concisely: */
     create_objects();

    return 0;
}
Exemplo n.º 11
0
int main(void)
{
	init();
	format();
	test_create_partition();
	create_objects();
	create_collection();
	#ifdef FULL_TEST
		remove_objects();
		write_objects();
		read_objects();
	#endif
	fini();
	return 0;
}
Exemplo n.º 12
0
static gboolean
create_texture_unlocked (GstVaapiTexture * texture)
{
  guint texture_id;

  if (texture->is_wrapped)
    texture_id = GST_VAAPI_TEXTURE_ID (texture);
  else {
    texture_id = gl_create_texture (texture->gl_target, texture->gl_format,
        texture->width, texture->height);
    if (!texture_id)
      return FALSE;
    GST_VAAPI_TEXTURE_ID (texture) = texture_id;
  }
  return create_objects (GST_VAAPI_TEXTURE_GLX (texture), texture_id);
}
Exemplo n.º 13
0
// Called at program start to bootstrap everything.
void handle_init() {
  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "handle_init");

  // Record the fallback font pointer so we can identify if this one
  // is accidentally returned from fonts_load_custom_font().
  fallback_font = fonts_get_system_font(FONT_KEY_FONT_FALLBACK);

  load_config();

#ifdef MAKE_CHRONOGRAPH
  load_chrono_data();
#endif  // MAKE_CHRONOGRAPH

  app_message_register_inbox_received(receive_config_handler);
  app_message_register_inbox_dropped(dropped_config_handler);

#define INBOX_MESSAGE_SIZE 200
#define OUTBOX_MESSAGE_SIZE 50

#ifndef NDEBUG
  uint32_t inbox_max = app_message_inbox_size_maximum();
  uint32_t outbox_max = app_message_outbox_size_maximum();
  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "available message space %u, %u", (unsigned int)inbox_max, (unsigned int)outbox_max);
  if (inbox_max > INBOX_MESSAGE_SIZE) {
    inbox_max = INBOX_MESSAGE_SIZE;
  }
  if (outbox_max > OUTBOX_MESSAGE_SIZE) {
    outbox_max = OUTBOX_MESSAGE_SIZE;
  }
  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "app_message_open(%u, %u)", (unsigned int)inbox_max, (unsigned int)outbox_max);
  AppMessageResult open_result = app_message_open(inbox_max, outbox_max);
  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "open_result = %d", open_result);

#else  // NDEBUG
  app_message_open(INBOX_MESSAGE_SIZE, OUTBOX_MESSAGE_SIZE);
#endif  // NDEBUG

  time_t now = time(NULL);
  struct tm *startup_time = localtime(&now);

  date_numeric_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);

  create_objects();
  compute_hands(startup_time, &current_placement);
  apply_config();
}
Exemplo n.º 14
0
int main (int argc, const char * argv[]) {
	/* a bunch of json: */
	char text1[]="{\n\"name\": \"Jack (\\\"Bee\\\") Nimble\", \n\"format\": {\"type\":       \"rect\", \n\"width\":      1920, \n\"height\":     1080, \n\"interlace\":  false,\"frame rate\": 24\n}\n}";
	char text2[]="[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]";
	char text3[]="[\n    [0, -1, 0],\n    [1, 0, 0],\n    [0, 0, 1]\n	]\n";
	char text4[]="{\n		\"Image\": {\n			\"Width\":  800,\n			\"Height\": 600,\n			\"Title\":  \"View from 15th Floor\",\n			\"Thumbnail\": {\n				\"Url\":    \"http:/*www.example.com/image/481989943\",\n				\"Height\": 125,\n				\"Width\":  \"100\"\n			},\n			\"IDs\": [116, 943, 234, 38793]\n		}\n	}";
	char text5[]="[\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.7668,\n	 \"Longitude\": -122.3959,\n	 \"Address\":   \"\",\n	 \"City\":      \"SAN FRANCISCO\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94107\",\n	 \"Country\":   \"US\"\n	 },\n	 {\n	 \"precision\": \"zip\",\n	 \"Latitude\":  37.371991,\n	 \"Longitude\": -122.026020,\n	 \"Address\":   \"\",\n	 \"City\":      \"SUNNYVALE\",\n	 \"State\":     \"CA\",\n	 \"Zip\":       \"94085\",\n	 \"Country\":   \"US\"\n	 }\n	 ]";

    char text6[] = "<!DOCTYPE html>"
        "<html>\n"
        "<head>\n"
        "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
        "  <style type=\"text/css\">\n"
        "    html, body, iframe { margin: 0; padding: 0; height: 100%; }\n"
        "    iframe { display: block; width: 100%; border: none; }\n"
        "  </style>\n"
        "<title>Application Error</title>\n"
        "</head>\n"
        "<body>\n"
        "  <iframe src="//s3.amazonaws.com/heroku_pages/error.html">\n"
        "    <p>Application Error</p>\n"
        "  </iframe>\n"
        "</body>\n"
        "</html>\n";

	/* Process each json textblock by parsing, then rebuilding: */
	doit(text1);
	doit(text2);
	doit(text3);
	doit(text4);
	doit(text5);
    doit(text6);

	/* Parse standard testfiles: */
/*	dofile("../../tests/test1"); */
/*	dofile("../../tests/test2"); */
/*	dofile("../../tests/test3"); */
/*	dofile("../../tests/test4"); */
/*	dofile("../../tests/test5"); */
/*	dofile("../../tests/test6"); */

	/* Now some samplecode for building objects concisely: */
	create_objects();

	return 0;
}
Exemplo n.º 15
0
void reset_memory_panic() {
  // The memory_panic_flag was set, indicating that something
  // somewhere failed to allocate memory.  Destory and recreate
  // everything, in the hopes this will clear out memory
  // fragmentation.

  memory_panic_flag = false;
  ++memory_panic_count;

  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "reset_memory_panic begin, count = %d", memory_panic_count);

  destroy_objects();
  create_objects();

  // Start resetting some options if the memory panic count grows too high.
  if (memory_panic_count > 1) {
    config.battery_gauge = IM_off;
    config.bluetooth_indicator = IM_off;
  }
  if (memory_panic_count > 2) {
    config.second_hand = false;
  } 
  if (memory_panic_count > 3) {
    for (int i = 0; i < NUM_DATE_WINDOWS; ++i) {
      config.date_windows[i] = DWM_off;
    }
  } 
  if (memory_panic_count > 4) {
    config.chrono_dial = 0;
  } 
  if (memory_panic_count > 5) {
    // At this point we hide the clock face.  Drastic!
  }

  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "reset_memory_panic done, count = %d", memory_panic_count);
}
Exemplo n.º 16
0
int main( int argc, char *argv[] ) {
  
  int arg;
  
  int use_tracker = FALSE;
  int use_isense = FALSE;
  int use_udp = FALSE;
  int orientation_only = FALSE;

  IsenseDataPacket iSenseData;
  UDPDataPacket udpData;
  int data_available = NO;
  
  for ( arg = 1; arg < argc; arg++ ) {
    
    if ( !strcmp( argv[arg], "-full" ) ) {
      width = 640;
      height = 480;
      border = false;
      fullscreen = true;
      stereo = false;
    }
    else if ( !strcmp( argv[arg], "-hmd" ) ) {
      width = 1280;
      height = 480;
      border = false;
      fullscreen = true;
      stereo = true;
//       HMDScreen( HMD_STEREO );
    }
    else if ( !strcmp( argv[arg], "-svga" ) ) {
      width = 2048;
      height = 768;
      border = false;
      fullscreen = true;
      stereo = true;
      HMDScreen( HMD_STEREO );
    }
    else if ( !strcmp( argv[arg], "-nVisL" ) ) {
      fprintf( stderr, "LowRes nVis\n" );
      width = 2048;
      height = 768;
      border = false;
      fullscreen = true;
      stereo = true;
//      HMDScreen( HMD_STEREO );
    }
    else if ( !strcmp( argv[arg], "-nVis" ) ) {
      width = 2560;
      height = 1024;
      border = false;
      fullscreen = true;
      stereo = true;
//      HMDScreen( HMD_STEREO );
    }
    else if ( !strcmp( argv[arg], "-noborder" ) ) border = FALSE;
    else if ( !strcmp( argv[arg], "-tracker" ) ) use_tracker = TRUE;
    else if ( !strcmp( argv[arg], "-isense" ) ) use_isense = TRUE;
    else if ( !strcmp( argv[arg], "-udp" ) ) use_udp = TRUE;
    else if ( !strcmp( argv[arg], "-ori" ) ) orientation_only = TRUE;
    else if ( !strcmp( argv[arg], "-sensor" ) ) {
      arg++;
      if ( arg < argc ) sscanf( argv[arg], "%d", &viewpoint_sensor );
      fprintf( stderr, "Using sensor %d.\n", viewpoint_sensor );
    }
    else closure_record = argv[arg];

  }
  
  fprintf( stderr, "Closure record: %s\n", closure_record );
  
    
  /* Start up optical tracker. */
  if ( use_tracker ) {
    SetupTracker();
    SensorSetHysteresis( 1, 2.0, 0.5 ); // mm and degrees
    /*
    * The simulated tracker goes through 7 phases.
    * The first is stationary.
    * The next three are translation movements along X,Y and Z, respectively.
    * The last three are rotations around Z, Y and X, respectively.
    * The following sets the amplitude of each phase.
    * This call will have no effect on real tracker movements.
    */
    SimulateSetMovement( viewpoint_sensor, sim_translation, sim_rotation ); 
    
    /* Shift the nominal viewpoint up, then tilt the view back down to look at the target. */
    viewpoint_position[Y] = nominal_head_height;
    SimulateSetLocation( viewpoint_sensor, viewpoint_position );
    viewpoint_orientation[Y][Y] = viewpoint_orientation[Z][Z] = cos( radians( nominal_head_tilt ) );
    viewpoint_orientation[Y][Z] = sin( radians( nominal_head_tilt ) ) ;
    viewpoint_orientation[Z][Y] = - viewpoint_orientation[Y][Z];
    SimulateSetOrientation( viewpoint_sensor, viewpoint_orientation );

    SimulateSetLocation( object_sensor, object_position );
    SimulateSetMovement( object_sensor, sim_translation, sim_rotation ); 
  }
  
  if ( use_isense || use_udp ) {
    if ( UDPTrackerInitClient( &trkr, NULL, DEFAULT_PORT ) ) {
      MessageBox( NULL, "Error opening socket.", "Isense UDP", MB_OK );
      use_isense = NO;
    }
  }
    
 /* 
  * Define a viewing projection with:
  *  45° vertical field-of-view - horizontal fov will be determined by window aspect ratio.
  *  60 mm inter-pupilary distance - the units don't matter to OpenGL, but all the dimensions
  *      that I give for the model room here are in mm.
  *  100.0 to 10000.0  depth clipping planes - making this smaller would improve the depth resolution.
  */
  viewpoint = new Viewpoint( 6.0, 45.0, 10.0, 10000.0);
  
   
  int x = 100, y = 100;
  
  /*
  * Create window. 
  */
  window = new OpenGLWindow();
  window->Border = border; // Remove borders for an HMD display.
  window->FullScreen = fullscreen;

  if ( window->Create( NULL, argv[0], 0, 0, width, height ) ) {
		/*
    * Create sets the new window to be the active window.
    * Setup the lights and materials for that window.
    */
    glDefaultLighting();
    glDefaultMaterial();
//    wall_texture->Define();
  }  
  window->Activate();
  window->SetKeyboardCallback( keyboard_callback );

  // Shade model
	glEnable(GL_TEXTURE_2D);							// Enable Texture Mapping ( NEW )
  glEnable(GL_LIGHTING);
  glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearDepth(1.0f);									// Depth Buffer Setup
	glEnable(GL_DEPTH_TEST);							// Enables Depth Testing
	glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations

  create_objects();

  TimerSet( &frame_timer, 10.0 );
  frame_counter = 0;
  for ( double angle = 0.0; true; angle += 5.0 ) {

    if ( TimerTimeout( &frame_timer )) {
      fprintf( stderr, "Frame rate: %f\n", (double) frame_counter / TimerElapsedTime( &frame_timer ) );

      if ( use_isense ) {
        UDPTrackerGetIsenseData( &trkr, &iSenseData );
        printf("Isense Quarternion %7.3f %7.3f %7.3f %7.3f   %.3f\n",
        iSenseData.Station[0].orientation[0],
        iSenseData.Station[0].orientation[1],
        iSenseData.Station[0].orientation[2],
        iSenseData.Station[0].orientation[3],
        
        iSenseData.Station[0].timestamp );
      }

      TimerStart( &frame_timer );
      frame_counter = 0;
    }
  
    if ( use_tracker ) {
      data_available = !GetSensorPositionOrientation( viewpoint_sensor, YES, viewpoint_position, viewpoint_orientation );
      if ( data_available ) {
        if ( !orientation_only ) viewpoint->SetPosition( viewpoint_position );
        viewpoint->SetOrientation( viewpoint_orientation );
      }
    }
    else if ( use_isense ) {
      data_available = !( UDPTrackerGetIsenseData( &trkr, &iSenseData ));
      if ( data_available ) {
        isense_to_matrix( iSenseData.Station[0].orientation, viewpoint_orientation );
        isense_to_vector( iSenseData.Station[0].position, viewpoint_position );
        scale_vector( 10.0, viewpoint_position, viewpoint_position );
        if ( !orientation_only ) viewpoint->SetPosition( viewpoint_position );
        viewpoint->SetOrientation( viewpoint_orientation );
      }
    }
    else if ( use_udp ) {
      data_available = !( UDPTrackerGetData( &trkr, &udpData ));
      if ( data_available ) {
        quaternion_to_matrix( udpData.Station[0].orientation, viewpoint_orientation );
        copy_vector( udpData.Station[0].position, viewpoint_position );
        scale_vector( 10.0, viewpoint_position, viewpoint_position );
        if ( !orientation_only ) viewpoint->SetPosition( viewpoint_position );
        viewpoint->SetOrientation( viewpoint_orientation );
      }
    }
    else {
      data_available = data_available;
    }

    if ( use_tracker ) {
      data_available = !GetSensorPositionOrientation( object_sensor, YES, object_position, object_orientation );
        object->SetPosition( object_position );
        object->SetOrientation( object_orientation );
    }
    else if ( use_isense && data_available ) {
      isense_to_matrix( iSenseData.Station[1].orientation, object_orientation );
      isense_to_vector( iSenseData.Station[1].position, object_position );
      scale_vector( 10.0, object_position, object_position );
      object->SetOrientation( object_orientation );
      if ( !orientation_only ) object->SetPosition( object_position );
    }
    else {
      object->SetOrientation( angle, j_vector );
      object->SetPosition( object_position );
    }

    
    window->Clear();

    if ( stereo ) {
      viewpoint->Apply( window, LEFT_EYE );
      render();

      viewpoint->Apply( window, RIGHT_EYE );
      render();
    }
    else {
      viewpoint->Apply( window, CYCLOPS );
      render();
    }
    window->Swap();
    if ( ! window->RunOnce() ) break;
 

    frame_counter++;
    
  }
  
  window->Destroy();
  
  if ( use_tracker ) KillTracker();
  
  RevertScreen();
  
  return( 0 );
  
}
Exemplo n.º 17
0
int
Identity_Server::init (int argc,
                       ACE_TCHAR* argv[])
{
  int result;

  try
    {
      result = this->orb_manager_.init (argc,
                                        argv);
      if (result == -1)
        return result;

      // Check the non-ORB arguments.
      result = this->parse_args (argc, argv);
      if (result < 0)
        return result;

      // Contact the <Object_Group_Factory> to create 2
      // <Object_Group>s, one random and one rr.
      CORBA::ORB_var orb = orb_manager_.orb ();
      CORBA::Object_var obj =
        orb->string_to_object (this->group_factory_ior_);
      Load_Balancer::Object_Group_Factory_var factory =
        Load_Balancer::Object_Group_Factory::_narrow (obj.in ());

      if (CORBA::is_nil (factory.in ()))
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Identity_Server::init: "
                           "problems using the factory ior\n"),
                          -1);

      ACE_DEBUG ((LM_DEBUG,
                  "Identity_Server: Requesting new Random Object "
                  "Group with id <Identity, Random>\n"));

      Load_Balancer::Object_Group_var random_group =
        factory->make_random ("Identity, Random");

      ACE_DEBUG ((LM_DEBUG,
                  "Identity_Server: Requesting new Round Robin "
                  "Object Group with id <Identity, Round Robin>\n"));

      Load_Balancer::Object_Group_var rr_group =
        factory->make_round_robin ("Identity, Round Robin");

      // Create the requested number of <Identity> objects, and
      // register them with the random and round robin
      // <Object_Group>s.

      ACE_DEBUG ((LM_DEBUG,
                  "Identity_Server: Registering %d object(s) "
                  "with <Identity, Random> Object Group\n",
                    random_objects_));
      create_objects (random_objects_,
                      random_group.in ());

      ACE_DEBUG ((LM_DEBUG,
                  "Identity_Server: Registering %d object(s) "
                  "with <Identity, Round Robin> Object Group\n",
                    random_objects_));
      create_objects (rr_objects_,
                      rr_group.in ());
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Identity_Server::init");
      return -1;
    }

  return 0;
}