Example #1
0
File: Space.cpp Project: GMIS/GMIS
void CSpace::CreateDefaultProerty(ePipeline& Pipe){
	Pipe.PushInt(0);
	Pipe.PushString(_T(""));
	ePipeline Empty;
	Pipe.PushPipe(Empty);
	//目前只有这些,其它后续再添加
}
Example #2
0
void CMemoryView::ResetData(ePipeline& DataList){
	
	CTitle* Title = (CTitle*)m_ChildList[1];
	Title->DeleteAll();
	Title->m_ObjectCount=0;

	for (int i=0; i<DataList.Size(); i+=2)
	{
		int64 InstanceID = *(int64*)DataList.GetData(i);
		ePipeline*  InstanceItem = (ePipeline*)DataList.GetData(i+1);
		tstring InstanceName = InstanceItem->GetLabel();
		CreateDataInstance(InstanceName);

		CTextItem* DataList = (CTextItem*)Title->m_ChildList[Title->m_ObjectCount-1];
		
		for (int j=0; j<InstanceItem->Size(); j++)
		{
			ePipeline* Data = (ePipeline*)InstanceItem->GetData(j);
			
			CMemoryView::CTextItem*  DataItem = Data2Item(j,Data);

			if (DataItem==NULL)
			{
				return;
			}	

			//DataItem->m_State = SPACE_NOTOOLABR;

			DataList->PushChild(DataItem);
		}
	}
	Layout();
}
Example #3
0
void  CDebugView::Item2Path(CVSpace2* Item,ePipeline& Path){
	assert(Item);
	
	Path.Push_Front(new eINT(Item->m_Alias));

	CVSpace2* Parent = Item->m_Parent;
	while (Parent != this)
	{
		Path.Push_Front(new eINT(Parent->m_Alias));
		Parent = Parent->m_Parent;
	}
}
Example #4
0
void  CAddressBar::SetCurSpaceAddress(ePipeline& Addr){
    m_CurAddress = _T("");

	while (Addr.Size())
	{
		tstring s = Addr.PopString();
        m_CurAddress +=s;
		if(Addr.Size()){
			m_CurAddress += _T("\\");
		}
	}
	Invalidate();
}
Example #5
0
File: Space.cpp Project: GMIS/GMIS
SpaceAddress  FindSpace(ePipeline& Path){
	SpaceAddress Addr;
	
	if (Path.Size()==0)
	{
		Addr.ParentID = ROOT_SPACE;
		Addr.ChildID  = LOCAL_SPACEID;
		return Addr;
	}
	
	CppSQLite3Buffer SQL;
	
	int64 ParentID = 0;
	int64 ChildID  = ROOT_SPACE;
	
	char       ParentName[30]; 
	while (Path.Size())
	{
		tstring Name = Path.PopString();
		AnsiString AnsiName = WStoUTF8(Name);
		
		ParentID = ChildID;
		ChildID  = 0;
		
		int64toa(ParentID,ParentName);
		
		SQL.format("select %s from \"%s\" where %s=\"%s\"",
			ITEM_ID,
			ParentName,
			ITEM_NAME,
			AnsiName.c_str()
			);
		CppSQLite3Query Result = GetWorldDB().execQuery(SQL);
		
		if(!Result.eof()){
			ChildID  = Result.getInt64Field(0);
			Result.nextRow();
		}else{
			return  Addr;
		}
	}
	
	assert(Path.Size()==0);
	
	Addr.ParentID = ParentID;
	Addr.ChildID  = ChildID;
    return Addr;	
}
Example #6
0
void  CBrainMemory::RegisterGlobalPeople(ePipeline& PeopleData){
	tstring& Name = *(tstring*)PeopleData.GetData(0);
	_tcsupr(&Name[0]);

	CLock lk(&m_MemoryMutex);
	m_GlobalPeopleList[Name] = PeopleData;	
};
Example #7
0
File: Space.cpp Project: GMIS/GMIS
int32 GetAllChildList(int64 ParentID, ePipeline& ChildList,int64 NotIncludeChildID /*=0*/){
    assert(ParentID >0);
	ChildList.Clear();

	char TableName[30];
	int64toa(ParentID,TableName);
	if(!GetWorldDB().tableExists(TableName)){
		return 0;
	}

	//ChildList.SetID(ParentID);

    CppSQLite3Buffer SQL;
	SQL.format("select %s,%s,%s,%s from \"%s\"",
		     ITEM_ID,
		     ITEM_NAME,
			 ITEM_TYPE,
			 ITEM_FINGERPRINT,
		     TableName
	);

	CppSQLite3Query Result = GetWorldDB().execQuery(SQL);
	
	while(!Result.eof()){
		int64      ChildID     = Result.getInt64Field(0);
		
		if (ChildID !=NotIncludeChildID)
		{
			AnsiString s    = Result.getStringField(1,"");
			
			tstring Name = UTF8toWS(s);
			Name = GetFileNoPathName(Name);
			Name = GetFileName(Name);
			
			int32      Type        = Result.getIntField(2);
			AnsiString FingerPrint = Result.getStringField(3,"");

			//ChildList.PushInt64(ChildID);
			ChildList.PushString(Name);
			ChildList.PushInt(Type);
			ChildList.PushString(FingerPrint);

		}
		Result.nextRow();
	}
	return ChildList.Size()/3;
}
Example #8
0
File: Space.cpp Project: GMIS/GMIS
void   CSpace::SetProerty(ePipeline& Pipe){
	assert(Size()>5);
	assert(Pipe.Size());

	assert(GetDataType(4) == TYPE_PIPELINE);
	ePipeline* Property = (ePipeline*)GetData(4);
	Property->Clear();
	*Property << Pipe;
};
Example #9
0
	bool IsEqualAddress(ePipeline& Address1,ePipeline& Address2)
	{
		int32 n = Address1.Size();
		if (n != Address2.Size())
		{
			return FALSE;
		}
		
		for (int i=0; i<n; i++)
		{
			int64& ID1 = *(int64*)Address1.GetData(i);
			int64& ID2 = *(int64*)Address2.GetData(i);
			if (ID1 != ID2)
			{
				return FALSE;
			}
		}
		return TRUE;
}
Example #10
0
void CDebugView::MassItem::Init(ePipeline& Pipe){
	m_Alias = Pipe.GetID();
	m_Name = Pipe.GetLabel();
	int64 Type = Pipe.PopInt();

	m_Type   = Type;

	if (m_Type == MASS_ELEMENT)
	{
		while(Pipe.Size()){
			eElectron E;
			Pipe.Pop(&E);
			ePipeline* ChildPipe = (ePipeline*)E.Value();
			MassItem* ChildItem = new MassItem();
			PushChild(ChildItem);
			ChildItem->Init(*ChildPipe);
		}
	}
}
Example #11
0
File: Space.cpp Project: GMIS/GMIS
void   CSpace::SetOwnerInfo(ePipeline& Pipe){
	assert(Size()>5);
	assert(Pipe.Size());
	
	assert(GetDataType(5) == TYPE_PIPELINE);
	ePipeline* OwnerInfo = (ePipeline*)GetData(5);

	OwnerInfo->Clear();
	*OwnerInfo << Pipe;
};
Example #12
0
void   CSpacePortal::OnRequestUseObject(int64 SourceID,ePipeline& RequestInfo){

  int64 EventID = RequestInfo.PopInt();
  ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0);
  ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1);

  CObjectData Object(*ObjectInfo);
  
  int64  ExecuterID = Object.m_ID;

  CLinker ExecuterLinker;
  GetLinker(ExecuterID,ExecuterLinker);
  if (!ExecuterLinker.IsValid())
  {		  
	  ExePipe->GetLabel() = Format1024(_T("Error: Executer not started."));
	  ExePipe->SetID(RETURN_ERROR);
	  
	  CLinker Requester;
	  GetLinker(SourceID,Requester);
	  if (Requester.IsValid())
	  {
		  CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
		  ePipeline& Letter = FeedbackMsg.GetLetter();
		  
		  Letter.PushPipe(*ExePipe);  
		  Requester().PushMsgToSend(FeedbackMsg);
	  }
	  return;
  }

  PushExecuterEvent(ExecuterID,SourceID,EventID);

  WriteLogDB(_T("Use Object Event:%I64ld"),EventID);


  CMsg NewMsg(MSG_OBJECT_RUN,NULL,EventID);
  ePipeline& NewLetter = NewMsg.GetLetter();
  NewLetter.PushPipe(*ExePipe);
  
  ExecuterLinker().PushMsgToSend(NewMsg);
  
};
Example #13
0
//以下函数内部使用无需加锁
//////////////////////////////////////////////////////////////////////////
	bool  CLinkerPipe::ReceiverID2LocalAddress(ePipeline& Receiver,ePipeline& LocalAddress){
		int64 ReceiverID = Receiver.PopInt();

		if (ReceiverID==SYSTEM_SOURCE)
		{
			LocalAddress.PushInt(ReceiverID);
			LocalAddress<<Receiver; //可能还有其它地址
			return TRUE;
		}
		
		assert(Receiver.Size()==0); //其它情况应该没有多余地址

		map<int64,ePipeline>::iterator It = m_LocalAddressList.find(ReceiverID);
		if(It != m_LocalAddressList.end()){
			ePipeline& Pipe =  It->second;
			LocalAddress = Pipe;
			return TRUE;
		}
		return FALSE;
    }
Example #14
0
void    CSpacePortal::OnRequestCloseObject(int64 SourceID,ePipeline& RequestInfo){

	int64 EventID = RequestInfo.PopInt();
	ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0);
	ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1);
	
	CObjectData Object(*ObjectInfo);
		

	//If it does not start the external organs, this is considered a normal close
	int64 ExecuterID = Object.m_ID;
	CLinker ExecuterLinker;
	GetLinker(ExecuterID,ExecuterLinker);
	if (!ExecuterLinker.IsValid())
	{				
		CLinker Requester;
		GetLinker(SourceID,Requester);
		if (Requester.IsValid())
		{
			CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
			ePipeline& Letter = FeedbackMsg.GetLetter();
			
			Letter.PushPipe(*ExePipe);  
			Requester().PushMsgToSend(FeedbackMsg);
		}
		return;
	}
	

	PushExecuterEvent(ExecuterID,SourceID,EventID);

	WriteLogDB(_T("Close Object Event:%I64ld"),EventID);


	CMsg NewMsg(MSG_OBJECT_CLOSE,NULL,EventID);
	ePipeline& NewLetter = NewMsg.GetLetter();

	NewLetter.PushPipe(*ExePipe);
	
    ExecuterLinker().PushMsgToSend(NewMsg);
}
Example #15
0
void CDebugView::Reset(ePipeline& ItemList){

	DeleteAll();

	m_Toolbar.m_Owner = NULL;
    m_SpaceFocused    = NULL;

	Layout();	
	
	m_TaskTimeStamp = ItemList.GetID();
	if(ItemList.Size()==0){
		return;
	};

	ePipeline* TaskPipe = (ePipeline*)ItemList.GetData(0);
	MassItem* Task = new MassItem;
	PushChild(Task);
	Task->Init(*TaskPipe);
	Task->m_Alias = 1; //任务ID是一个64位整数,显示不方便,这里改为1
    Layout();
	return ;
};
Example #16
0
void  CBrainMemory::RegisterGlobalObject(ePipeline& ObjectData){
	tstring& Name = *(tstring*)ObjectData.GetData(0);
//    tstring& Fingerprint = *(tstring*)ObjectData.GetData(2);
	_tcslwr(&Name[0]);
//	_tcsupr(&Fingerprint[0]);
	
	CLock lk(&m_MemoryMutex);
	map<tstring,ePipeline>::iterator It = m_GlobalObjectList.find(Name);
	if(It!=m_GlobalObjectList.end()){
		return;
	};

	m_GlobalObjectList[Name] = ObjectData;
};
Example #17
0
void CBrainMemory::RegisterGlobalLogic(tstring& Name, const tstring& LogicText, ePipeline& LogicData, uint32 State,
									    tstring LogicMeaning /*=""*/, tstring InputDescrip /*=""*/, tstring OutputDescrip /*=""*/ )
{	
	ePipeline LogicItem;
	LogicItem.SetLabel(Name.c_str());
	LogicItem.PushInt(State);
	LogicItem.PushString(LogicText);
	LogicItem.PushString(LogicMeaning);
	LogicItem.PushString(InputDescrip);
	LogicItem.PushString(OutputDescrip);
    LogicItem.Push_Directly(LogicData.Clone());
	ePipeline RefList;
	LogicItem.PushPipe(RefList); //引用名:谁引用,字符串成对保存

	CLock lk(&m_MemoryMutex);
	m_GlobalLogicList.PushPipe(LogicItem);
};
Example #18
0
File: Space.cpp Project: GMIS/GMIS
CObjectData::CObjectData(ePipeline& ObjectData){
	if (ObjectData.Size()!=4)
	{
		return;
	}
	m_ID   = ObjectData.GetID();
	m_Name = *(tstring*)ObjectData.GetData(0);
	m_Type = *(SPACETYPE*)ObjectData.GetData(1);
	m_Fingerprint = *(tstring*)ObjectData.GetData(2);
	ePipeline* Path = (ePipeline*)ObjectData.GetData(3);
	m_Address << *Path;
}
Example #19
0
	int64  CLinkerPipe::LocalAddress2SenderID(ePipeline& LocalAddress)
	{
		assert(LocalAddress.Size()!=0);
		
		//CLock lk(m_Mutex);
		map<int64,ePipeline>::iterator It = m_LocalAddressList.begin();
		while (It != m_LocalAddressList.end())
		{
			ePipeline& Address = It->second;
			if(IsEqualAddress(Address,LocalAddress)){
				return It->first;
			}
			It++;
		}
	
		int64 SenderID = CreateTimeStamp();
		tstring s = GetTimer()->GetFullTime(SenderID);

		ePipeline& Address = m_LocalAddressList[SenderID];
		Address<<LocalAddress;
		return SenderID;
    }
Example #20
0
File: Space.cpp Project: GMIS/GMIS
void CSpace::CreateDefaultOwner(ePipeline& Pipe)
{
    tstring  Name = _T("Unkown");
	tstring  Cryptograhp = _T("");
	SPACE_RIGHT  Right = NO_RIGHT;
    tstring  Email = _T("Unkown");
    tstring  Memo = _T("Unkown");
   
    eBLOB* Validata = new eBLOB();   
	
    Pipe.PushString(Name);
    Pipe.PushInt(Right);
    Pipe.PushString(Cryptograhp);
    Pipe.PushString(Email);
    Pipe.PushString(Memo);  
    Pipe.Push_Directly(Validata);
};
Example #21
0
void   CSpacePortal::OnRequestStartObject(int64 SourceID,ePipeline& RequestInfo){

  int64 EventID = RequestInfo.PopInt();
  ePipeline* ObjectInfo = (ePipeline*)RequestInfo.GetData(0);
  ePipeline* ExePipe = (ePipeline*)RequestInfo.GetData(1);

  CObjectData Object(*ObjectInfo);
  
  ePipeline AddrData = Object.m_Address;
  assert(Object.m_ID != 0);

  //Checks whether the specified object addresses is valid
  SpaceAddress Address = FindChildSpace(AddrData,Object.m_Fingerprint);
  if (!Address.IsValid())
  {
	  CLinker Requester;
	  GetLinker(SourceID,Requester);
	  if (Requester.IsValid())
	  {
		CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
		ePipeline& Letter = FeedbackMsg.GetLetter();
	    ExePipe->SetID(RETURN_ERROR);
		ExePipe->GetLabel() = Format1024(_T("Error: object address invalid"));
		Letter.PushPipe(*ExePipe);  
		Requester().PushMsgToSend(FeedbackMsg);
	  }
	  return;
  }

  //Need to open the corresponding DLL object in advance, in order to determine the type of executer
 
  //CSpace Space(Address.ParentID,Address.ChildID);	  

  AddrData = Object.m_Address;

  tstring FilePath = SpacePath2FileAddress(AddrData);
  tstring ObjectName = GetFileName(Object.m_Name); //不含扩展名

  FilePath += _T("\\")+ObjectName;
  FilePath += _T("\\")+Object.m_Name;

  Dll_Object TempDll(Object.m_ID,FilePath);
  if (!TempDll.IsValid())
  {
	  int32 error = ::GetLastError();

	  ExePipe->SetID(RETURN_ERROR);  
	  ExePipe->GetLabel() = Format1024(_T("Load object fail: <%s>"),FilePath.c_str());
	  CLinker Requester;
	  GetLinker(SourceID,Requester);
	  if (Requester.IsValid())
	  {
		  CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
		  ePipeline& Letter = FeedbackMsg.GetLetter();

		  Letter.PushPipe(*ExePipe);  
		  Requester().PushMsgToSend(FeedbackMsg);
	  }
	  return ;
  }

  DLL_TYPE DllType = TempDll.GetDllType();
  tstring ExecuterFile;
  switch (DllType)
  {
	  case DLL_VC6:
		  {
              ExecuterFile = _T("EXE_VC6.EXE");
		  }
		  break;
	  case DLL_VC6D:
		  {
			  ExecuterFile = _T("EXE_VC6D.EXE");
		  }
		  break;
	  case DLL_VC10:
		  {
			  ExecuterFile = _T("EXE_VC10.EXE");
		  }
          break;
	  case DLL_VC10D:
		  {
			  ExecuterFile = _T("EXE_VC10D.EXE");
		  }
		  break;
	  default:
		  {
			  ExePipe->GetLabel() = Format1024(_T("Error: dll type not support:%d"),(int)DllType);
			  ExePipe->SetID(RETURN_ERROR);

			  CLinker Requester;
			  GetLinker(SourceID,Requester);
			  if (Requester.IsValid())
			  {
				  CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
				  ePipeline& Letter = FeedbackMsg.GetLetter();
				  
				  
				  Letter.PushPipe(*ExePipe);  
				  Requester().PushMsgToSend(FeedbackMsg);
			  }
			  return;
		  }
  }

  //start a executer     
  int64 ExeSourceID = Object.m_ID;  //ExecuterID is equal to the external object instance ID
  

  bool ret = StartExecuter(ExeSourceID,ExecuterFile);
  if (!ret)
  {
	  ExePipe->GetLabel() = Format1024(_T("Error: Executer start fail."));
	  ExePipe->SetID(RETURN_ERROR);

	  CLinker Requester;
	  GetLinker(SourceID,Requester);
	  if (Requester.IsValid())
	  {
		  CMsg FeedbackMsg(MSG_TASK_FEEDBACK,NULL,EventID);
		  ePipeline& Letter = FeedbackMsg.GetLetter();

		  Letter.PushPipe(*ExePipe);  
		  Requester().PushMsgToSend(FeedbackMsg);
	  }
	  return;
  }
  RegisterExecuterUser(SourceID,ExeSourceID);

  CLinker ExecuterLinker;
  GetLinker(ExeSourceID,ExecuterLinker);	  
 
  //Register a start  external object event
  PushExecuterEvent(ExeSourceID,SourceID,EventID);

  WriteLogDB(_T("Start Object Event:%I64ld"),EventID);

  //send execute msg
  CMsg NewMsg(MSG_OBJECT_START,NULL,EventID);
  ePipeline& NewLetter = NewMsg.GetLetter();
  NewLetter.PushString(FilePath);
  NewLetter.PushPipe(*ExePipe);
  
  ExecuterLinker().PushMsgToSend(NewMsg);  
};
Example #22
0
File: Space.cpp Project: GMIS/GMIS
void CSpace::CreateDefaultOwnerInfo(ePipeline& Pipe){
	Pipe.PushInt(NO_RIGHT);
    ePipeline Empty;
	Pipe.PushPipe(Empty);
}
Example #23
0
void CPipeView::PrintPipe(ePipeline& Pipe,int32 TabNum/*=0*/)
{
	
	TCHAR buffer[200];
    int i;
	int size = Pipe.Length();

	int Tab=TabNum;

	for(i=0; i<Tab; i++){
		buffer[i]=_T('\t');
	}

	//限制嵌套数目
	if(Tab>90){
		throw std::exception("WARNING: Nest Pipe too much, end View");
	}

	tstring PipeLabel = Pipe.m_Label;
	_stprintf(buffer+Tab,_T("Pipe<%s>: %d Data\n"),PipeLabel.c_str(), Pipe.Size());
	m_Result.PushString(buffer);

	Tab = ++TabNum;
	for(i=0; i<Tab; i++){
		buffer[i]=_T('\t');
	}

	for(i=0; i<size; i++){
	   uint32 Type = Pipe.GetDataType(i);
	   switch(Type){
	   case TYPE_NULL:
		   {
		   _stprintf(buffer+Tab,_T("%03d NULL\n"),i);
		   m_Result.PushString(buffer);
		   }
		   break;

	   case TYPE_INT:
		   {
		   int64* value=(int64 *)Pipe.GetData(i);
           _stprintf(buffer+Tab,_T("%03d INT64: %I64ld\n"),i, *value);
           m_Result.PushString(buffer);
		   }
		   break;
	   case TYPE_FLOAT:
		   {
		   float64* value=(float64 *)Pipe.GetData(i);
           _stprintf(buffer+Tab,_T("%03d FLOAT64: %f\n"),i, *value);
           m_Result.PushString(buffer);
		   }
		   break;
	   case TYPE_STRING:
		   {
		   tstring* value=(tstring *)Pipe.GetData(i);
           _stprintf(buffer+Tab,_T("%03d STRING:"),i);
		   //MBPrintf("test1","%s",value->c_str());
		   tstring s(buffer);
		   s +=(*value);
		   s +=_T('\n');

           m_Result.PushString(s);
		   //MBPrintf("test","size=%d",Result.Size());
		   }
		   break;
	   case TYPE_PIPELINE:
		   {
		   ePipeline* value=(ePipeline *)Pipe.GetData(i);
    
		   //如果不用PipeNum++而用t++,导致t增大不能恢复,中间形成空格,之后打印的数据不可见
		   PrintPipe(*value,TabNum);
		   }      
		   break;
	   }
	}
    TabNum--;
}