示例#1
0
void rt_pvd_udb::load_systemgroup( SystemList *systemgroup)
{
  procom_obj item;
  pwr_sClass_SystemGroupReg *body;
  char sname[120];
  char *s;

  body = (pwr_sClass_SystemGroupReg *) calloc( 1, sizeof(pwr_sClass_SystemGroupReg));
  item.body = body;
  gu->get_system_name( systemgroup, sname);
  if (( s = strrchr( sname, '.')))
    strcpy( item.name, s+1);
  else
    strcpy( item.name, sname);

  gu->get_system_data( sname, &body->Attributes, &item.oix, body->Description);
  item.oix++;

  if ( next_oix <= item.oix)
    next_oix = item.oix + 1;
  item.cid = pwr_cClass_SystemGroupReg;
  item.fthoix = menu_stack[menu_cnt - 1];
  item.bwsoix = m_list[item.fthoix].lchoix;
  if ( item.bwsoix)
    m_list[item.bwsoix].fwsoix = item.oix;
  if ( m_list[item.fthoix].fchoix == 0)
    m_list[item.fthoix].fchoix = item.oix;
  m_list[item.fthoix].lchoix = item.oix;

  item.body_size = sizeof(pwr_sClass_SystemGroupReg);

  menu_stack[menu_cnt] = item.oix;
  menu_cnt++;
  if ( m_list.size() <= item.oix + 1)
    m_list.resize( item.oix + 1);
  m_list[item.oix] = item;

  UserList *user = systemgroup->first_user();
  while ( user) {
    load_user( user, systemgroup);

    user = user->next_user();
  }
  SystemList *sg = systemgroup->first_system();
  while ( sg) {
    load_systemgroup( sg);

    sg = sg->next_system();
  }
  menu_cnt--;
}
示例#2
0
void rt_pvd_udb::load( pwr_tStatus *rsts)
{
  char		filename[256];
  int		sts;

  if ( gu)
    gu->clear();
  else
    gu = new GeUser();
  sts = dcli_get_defaultfilename( user_cFilename, filename, "");
  gu->load( filename);
 
  // Create Root object

  procom_obj rootitem;
  if ( m_env == pvd_eEnv_Wb) {
    strcpy( rootitem.name, "UserDatabase");
    rootitem.cid = pwr_eClass_PlantHier;
    rootitem.oix = 0; 
  }
  else {
    strcpy( rootitem.name, "VolUserDatabase");
    rootitem.cid = pwr_eClass_ExternVolume;
    rootitem.oix = 0; 
    rootitem.body_size = sizeof(pwr_sExternVolume);
    rootitem.body = calloc( 1, rootitem.body_size);
  }
  m_list.push_back(rootitem);
  menu_stack[menu_cnt] = rootitem.oix;
  menu_cnt++;

  SystemList *systemgroup = gu->root_system();
  while ( systemgroup) {
    load_systemgroup( systemgroup);

    systemgroup = systemgroup->next_system();
  }

  if ( m_env == pvd_eEnv_Rt) {
    // Convert to Rt style
    for ( int i = 1; i < (int)m_list.size(); i++) {
      if ( m_list[i].bwsoix == 0)
	m_list[i].bwsoix = m_list[m_list[i].fthoix].lchoix;
      if ( m_list[i].fwsoix == 0)
	m_list[i].fwsoix = m_list[m_list[i].fthoix].fchoix;
    }  
  }
  
}