当前位置: 首页>>代码示例>>C++>>正文


C++ CData类代码示例

本文整理汇总了C++中CData的典型用法代码示例。如果您正苦于以下问题:C++ CData类的具体用法?C++ CData怎么用?C++ CData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool CUInt32::operator>(CData &x)
{
	if( x.getType() == UINT32 )
	{
		CUInt32 & d=dynamic_cast<CUInt32&>(x);
		if(_data > d._data) return true;
		else return false;
	}
	else if(x.getType() == INT64)
	{
		CInt64 & d=dynamic_cast<CInt64&>(x);
		if( d._data < _data) return true;
		else return false;
	}
	else if( x.getType() == UINT64)
	{
		CUInt64 & d=dynamic_cast<CUInt64&>(x);
		if( d._data < _data) return true;
		else return false;
	}
	else if(x.getType() == FLOAT)
	{
		CFloat & d=dynamic_cast<CFloat&>(x);
		if( d._data < _data) return true;
		else return false; 
	}
	else if(x.getType() == DOUBLE)
	{
		CDouble & d=dynamic_cast<CDouble&>(x);
		if( d._data < _data) return true;
		else return false;
	}
	else return false;
}
开发者ID:ownyang,项目名称:cdp,代码行数:34,代码来源:data_t.cpp

示例2: EventMgr_FireEvent

int EventMgr_FireEvent(lua_State* l)
{
	//args: event name, [parameter or parameter table]

	int ArgCount = lua_gettop(l);
		
	if (ArgCount < 1 || ArgCount > 2 || !lua_isstring(l, 1))
	{
		lua_settop(l, 0);
		return 0;
	}

	PParams Params;
	if (ArgCount > 1 && !lua_isnil(l, 2))
	{
		CData Data;
		ScriptSrv->LuaStackToData(Data, 2, l);
		if (lua_istable(l, 2)) Params = (PParams)Data;
		else if (Data.IsValid())
		{
			//???for all args read and push into array?
			Params = n_new(CParams(1));
			Params->Set(CStrID::Empty, Data);
		}
	}

	EventMgr->FireEvent(CStrID(lua_tostring(l, 1)), Params);
	return 0;
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:29,代码来源:SIEventManager.cpp

示例3: loadScript

bool loadScript(CFile* f)
{
	if( !f->isOpen() )
		return false;
	CData d;
	d.fromFile(f);
	d.write("\x0",1);
	String s = d.data();
	try{
		object main_module((
		handle<>(borrowed
		(PyImport_AddModule("__main__")))));

		object main_namespace =
			main_module.attr("__dict__");

		boost::algorithm::replace_all(s,"\r\n","\n");
		handle<> ignored(PyRun_String(
			s.c_str()
			, Py_file_input
			, main_namespace.ptr()
			, main_namespace.ptr()
			));
	} catch(error_already_set)
	{
		PyErr_Print();
		return false;
	};
	return true;
};
开发者ID:proton,项目名称:ireon,代码行数:30,代码来源:py_init.cpp

示例4: Send_LOGIN

void CChatCDlg::Send_LOGIN(CString id, CString pass)
{
	CData data;
	data.SetLogindata(D_LOGIN, id, pass);

	*m_pDataSocket << data;
}
开发者ID:asdlei00,项目名称:project-jb,代码行数:7,代码来源:ChatCDlg.cpp

示例5: count_x_out_fn

int CFeasibilityMap::count_x_out_fn(CData &Data,int i_tau, int i_original,int n_simul, Uniform &randUnif) {
	
  // double case2_count_out = 0;
	int case2_count_out = 0; // Changed by Hang on 5/16/2015
	
  ColumnVector s_i = tau_to_s_fn( i_tau, Data.n_var );   
  ColumnVector item_by_joint = Data.copy_non_balance_edit(s_i);
  ColumnVector tilde_y_i = Data.log_D_Observed.row(i_original).t();
  
	for (int i_simul=1; i_simul<=n_simul; i_simul++){
			//Generate from uniform distribution
			ColumnVector y_q = tilde_y_i;
			for ( int temp_j=1; temp_j<=Data.n_var; temp_j++ ){
				if ( item_by_joint(temp_j)==1 ){
					y_q(temp_j) = Data.logB_L(temp_j)+Data.logB_U_L(temp_j)*randUnif.Next(); 
				} 
			} 
	
			ColumnVector x_q = exp_ColumnVector(y_q) ;
      Data.update_full_x_for_balance_edit(x_q);
			// if (!Data.PassEdits(x_q)) { case2_count_out += 1.0;}
      if (!Data.PassEdits(x_q)) { case2_count_out += 1;}  // Changed by Hang on 5/16/2015
	} 
  if (case2_count_out ==0) {
    case2_count_out = 1;
  }
	return case2_count_out; // ADDED by Hang on 5/16/2015
}
开发者ID:QuanliWang,项目名称:EditImputeCont,代码行数:28,代码来源:CFeasibilityMap.cpp

示例6: Write

int CClientSocket::Write(CData& data)
{
  if (m_sock == -1)
  {
    m_error = "socket closed";
    return FAIL;
  }

  int bytestowrite = data.GetSize();
  int byteswritten = 0;

  //loop until we've written all bytes
  while (byteswritten < bytestowrite)
  {
    //wait until socket becomes writeable
    int returnv = WaitForSocket(true, "Write");

    if (returnv == FAIL || returnv == TIMEOUT)
      return returnv;

    int size = send(m_sock, data.GetData() + byteswritten, data.GetSize() - byteswritten, 0);
    
    if (size == -1)
    {
      m_error = "send() " + m_address + ":" + ToString(m_port) + " " + GetErrno();
      return FAIL;
    }

    byteswritten += size;
  }
  return SUCCESS;
}
开发者ID:Nash2001,项目名称:boblight-for-enigma2,代码行数:32,代码来源:sockets.cpp

示例7: Send_JOIN_MEMBER

void CChatCDlg::Send_JOIN_MEMBER(CString id, CString pass, CString name, CString serverip)
{
	CDataSocket sock;
	CData data;

	//////// 임시 서버 접속
	// 클라이언트 소켓 생성
	if(!sock.Create())
	{
		AfxMessageBox(_T("클라이언트 소켓 생성 실패"));
		return;
	}
	// 서버에 접속 요청
	if(!sock.Connect(serverip, 3666)) // 서버아이피와 포트번호
	{
		AfxMessageBox(_T("서버를 찾을 수 없습니다."));
		sock.Close();
		return;
	}
	// 클라이언트 소켓 초기화
	sock.Init(this);

	//////// 데이터 전송
	data.Setdata(D_JOIN_MEMBER, true, id, name, "", "", pass);
	sock << data;

	AfxMessageBox(_T("로그인 해 주세요.."));
	::Sleep(1000);

	// 접속해제
	sock.Close();
}
开发者ID:asdlei00,项目名称:project-jb,代码行数:32,代码来源:ChatCDlg.cpp

示例8: RootPanel

void CInstructor::Initialize()
{
    if (m_pCurrentPanel)
    {
        RootPanel()->RemoveControl(m_pCurrentPanel);
    }

    m_pCurrentPanel = NULL;

    Clear();

    FILE* fp = tfopen_asset("scripts/instructor.txt", "r");

    if (!fp)
    {
        TMsg("Couldn't load instructor script.\n");
        return;
    }

    std::shared_ptr<CData> pData(new CData());
    CDataSerializer::Read(fp, pData.get());

    for (size_t i = 0; i < pData->GetNumChildren(); i++)
    {
        CData* pChildData = pData->GetChild(i);

        if (pChildData->GetKey() == "Lesson")
            ReadLesson(pChildData);
    }
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:30,代码来源:instructor.cpp

示例9: CData

CData* CDecodeFlowData::readData ( const QDomElement& data)
{
  bool bOk = false;
  CData* d = NULL;
  
  QDomElement id = data.firstChildElement("id");
  QDomElement name = data.firstChildElement("name");
  QDomElement cl = data.firstChildElement("class");
  QDomElement flowType = data.firstChildElement("flow-type");
  
  if (!id.isNull() && !name.isNull() &&
      !cl.isNull() && !flowType.isNull())
  {
    bOk = true;
    d = new CData(name.text());
    d->setID(id.text().toInt(&bOk));
    d->setDataType((CData::dataType) (flowType.text().toInt(&bOk)) );
    
    CClass* c = m_typeFactory->getTypeById(d->getID());
    if (c != NULL)
      d->setClass(c);
    else
      bOk = false;   
  }
  
  if ((d != NULL) && (bOk == false))
  {
    delete d;
    d = NULL;
  }
  
  return d;
}
开发者ID:miko53,项目名称:graphia,代码行数:33,代码来源:decodeflowdiagram.cpp

示例10: removeChar

void CCMWorldContext::removeChar(uint id)
{
	CData data;
	data.wrt((byte)(SIGNALS_START+4));
	data << id;
	write(data);
};
开发者ID:proton,项目名称:ireon,代码行数:7,代码来源:cm_world_context.cpp

示例11: Serialize

void CSeriDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar << m_List.GetCount();
		for(POSITION pos = m_List.GetHeadPosition(); pos != NULL; )
			m_List.GetNext(pos)->Serialize(ar);
	}
	else
	{
		m_List.RemoveAll();
		// TODO: add loading code here
		int nCount;
		CData *pData;

		ar >> nCount;
		for(int i=0; i<nCount; i++)
		{
			pData = new CData;
			pData->Serialize(ar);
			m_List.AddTail(pData);
		}
	}
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:25,代码来源:SeriDoc.cpp

示例12: SMT_GetCurrFileName

/*=================================================================
* Function ID :  SMT_GetCurrFileName
* Input       :  void
* Output      :  void
* Author      :  
* Date        :  2006  2
* Return	  :  void
* Description :  获取当前文件
* Notice	  :  
*=================================================================*/
bool CSmartCommunicationDlg::SMT_GetCurrFileName(char* cCurFileName,char* sBakFileName)
{
	char    sCurFileName[256];
	char	FileName[256];
	CMyLog  cLog;
	CData	cData;

	memset(sCurFileName,0,sizeof sCurFileName);
	memset(FileName,0,sizeof FileName);

	strcpy(sBakFileName,m_DealPath);
	strcat(sBakFileName,"\\Bak\\Bak_");
	memcpy(sBakFileName+strlen(sBakFileName),cData.GetSysTime(),8);	
	strcat(sBakFileName,"_DealData.txt");
	
	strcpy(FileName,m_DealPath);
	strcat(FileName,"\\");
	memcpy(FileName+strlen(FileName),cData.GetSysTime(),8);	
	strcat(FileName,"_DealData");
	strcpy(sCurFileName,FileName);
	strcat(sCurFileName,".txt");
	if( cData.FileIsExist(sCurFileName) )
	{
		if( rename(sCurFileName,FileName)>=0 )
		{
			strcpy(cCurFileName,FileName);
			return true;
		}
	}	
	return false;
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:41,代码来源:SmartCommunicationDlg.cpp

示例13: CalculateInitProbA

void CParam::CalculateInitProbA(CData &Data) {
  // initial value of Y_out_compact and z_out
  int count_out = 0;  int count_in = 0;
  ColumnVector z_out_large(toolarge_nout);
  Matrix Y_out_compact_large(toolarge_nout,n_var_independent);
  while ( (count_in < Data.n_sample) && (count_out < toolarge_nout) ) {
    int k = rdiscrete_fn(pi);
    ColumnVector mu_k = Mu.column(k);             // Note that mu_k is Mu.column(k)
    ColumnVector y_compact_i = rMVN_fn( mu_k,LSIGMA[k-1] );
    ColumnVector x_compact_i = exp_ColumnVector(y_compact_i);

    ColumnVector x_i(Data.n_var) ;
    Data.UpdateFullVector(x_compact_i, x_i);
    Data.update_full_x_for_balance_edit(x_i);

    if (Data.PassEdits(x_i)) {
      count_in++;
    } else {
      count_out++;
      Y_out_compact_large.row(count_out) = y_compact_i.t();
      z_out_large(count_out)=k;
    }
  }
  Matrix Y_out_compact = Y_out_compact_large.rows(1,count_out) ;    // cut extra space
  ColumnVector z_out = z_out_large.rows(1,count_out) ;    // cut extra space
  // calculate n_z and Sum_groupX
  Matrix Y_aug_compact = Y_in_compact & Y_out_compact;
  ColumnVector z_aug = z_in & z_out;
  int n_out = z_out.nrows();
  Prob_A =  (1.0 * Data.n_sample / (Data.n_sample+n_out));
}
开发者ID:QuanliWang,项目名称:EditImputeCont,代码行数:31,代码来源:CParam.cpp

示例14: assert

void CQModelValue::slotBtnCopy()
{
  std::string name = "quantity";
  int i = 1;

  assert(mpDataModel != NULL);

  while (!(mpModelValue = mpDataModel->getModel()->createModelValue(name)))
    {
      i++;
      name = "quantity_";
      name += TO_UTF8(QString::number(i));
    }

  CData ToCopy = mpObject->toData();
  ToCopy.addProperty(CData::Property::OBJECT_NAME, name);
  ToCopy.removeProperty(CData::Property::OBJECT_INDEX);
  ToCopy.removeProperty(CData::OBJECT_UUID);
  ToCopy.removeProperty(CData::OBJECT_REFERENCES);

  CUndoData::CChangeSet Changes;
  mpModelValue->applyData(ToCopy, Changes);

  CUndoData UndoData(CUndoData::Type::INSERT, mpModelValue);
  ListViews::addUndoMetaData(this, UndoData);
  UndoData.addMetaDataProperty("Widget Object CN (after)", mpModelValue->getCN());
  UndoData.addMetaDataProperty("Widget Object Name (after)", mpModelValue->getObjectName());

  slotNotifyChanges(mpDataModel->recordData(UndoData));
}
开发者ID:copasi,项目名称:COPASI,代码行数:30,代码来源:CQModelValue.cpp

示例15: Initialize

void CParam::Initialize(CData &Data){
  n_pheno = Data.Y.n_rows ; n_SNP = Data.Y.n_cols ; // constants but stored in CParam for convienence
  Data.logY = arma::zeros<arma::mat>(n_pheno,n_SNP) ; 
		// Note 1. This is used to calculate sum of log y_it when e_it=1. 
		//      2. (Weak signal) Because e_it=0 with y_it <= 0 by definition (model assumption),
		//          we will not use log y_it for e_it=0 and store zero here. 
		//			3. (Strong signal) Also, we put e_it=1 when y_it > threshold    // V 1.3.1 
  for (int i_pheno=0; i_pheno<n_pheno; i_pheno++ ){
    for (int i_SNP=0; i_SNP<n_SNP; i_SNP++ ){
      if ( Data.Y(i_pheno,i_SNP) > 0){ // V 2.0.2
        Data.logY(i_pheno,i_SNP) = log(Data.Y(i_pheno,i_SNP)) ;
				if ( Data.Y(i_pheno,i_SNP) > Data.threshold_on ) E_mat(i_pheno,i_SNP) = 1 ; 
      } else {
      	E_mat(i_pheno,i_SNP) = 0 ;
      }
    }
  } 
  
  normC = normC_fn(Beta, Data) ;	// Ver_1_4_1
  if ( normC < 0 ){
    Rcpp::stop("The initialized normC has a negative value.") ;
  }
  Data.msg_level = 0; //0 errors only; 1: errors and warnings; 2: errors, warnings and information
  
  sum_E_ijt = arma::zeros<arma::cube>(n_pheno,n_pheno,n_SNP) ; 
  
  is_initialized = 1 ; 
}
开发者ID:dongjunchung,项目名称:GGPA,代码行数:28,代码来源:3_Param.cpp


注:本文中的CData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。