bool wxJigsawEditorDocument::AppendChildren(wxJigsawShape * dest, 
		wxJigsawShapeGroup * group, size_t beforeIndex)
{
	do
	{
		if(!dest || !group) break;
		if(dest->GetChildren().GetCount() < beforeIndex) break;
		
		wxJigsawShape * shape(NULL);
		wxJigsawShapeList::Node * firstNode = group->GetShapes().GetFirst();
		wxJigsawShapeList::Node * lastNode = group->GetShapes().GetLast();		
		shape = firstNode->GetData();
		if(!shape || !shape->GetHasBump()) break;
		shape = lastNode->GetData();
		if(!shape || !shape->GetHasNotch()) break;

		size_t realIndex(beforeIndex);
		for(wxJigsawShapeList::Node * node = group->GetShapes().GetFirst(); 
			node; node = group->GetShapes().GetFirst(), realIndex++)
		{
			wxJigsawShape * insertShape = node->GetData();
			if(!insertShape) continue;
			group->Detach(insertShape);
			insertShape->SetParent(dest);
			dest->GetChildren().Insert(realIndex, insertShape);
		}
		GetGroups().DeleteObject(group);
		wxJigsawEditorView * view = wxDynamicCast(GetFirstView(), wxJigsawEditorView);
		RequestSizeRecalculation();
		//UpdateLayout(view->GetScale());
		return true;
	}
	while(false);
	return false;
}
Esempio n. 2
0
void plProfileManagerFull::ShowNextGroup()
{
    plString curGroup;
    if (fShowGroups.begin() != fShowGroups.end())
        curGroup = *(fShowGroups.begin());

    GroupSet groups;
    GetGroups(groups);

    plString nextGroup;
    if (!curGroup.IsNull())
    {
        CreateStandardGraphs(curGroup.c_str(), false);

        GroupSet::iterator it = groups.find(curGroup);
        it++;
        if (it != groups.end())
        {
            nextGroup = *it;
        }
        ISetActive(curGroup.c_str(), false);
    }
    else
    {
        nextGroup = *(groups.begin());
    }

    fShowGroups.clear();
    if (!nextGroup.IsNull())
    {
        ISetActive(nextGroup.c_str(), true);
        CreateStandardGraphs(nextGroup.c_str(), true);
        fShowGroups.insert(nextGroup);
    }
}
void wxJigsawEditorDocument::RequestSizeRecalculation()
{
	for(wxJigsawShapeGroupList::Node * node = GetGroups().GetFirst(); node; node = node->GetNext())
	{
		wxJigsawShapeGroup * group = node->GetData();
		if(!group) continue;
		group->RequestSizeRecalculation();
	}
}
Esempio n. 4
0
//---------------------------------------------------------------------------
const boost::shared_ptr<const ribi::gtst::Participant> ribi::gtst::Server::LetLogin(const boost::shared_ptr<const SafeIpAddress>& ip_address)
{
  std::lock_guard<std::recursive_mutex> lock(m_mutex);

  //Check for participants that reloaded the page by pressing F5
  if (GetGroups()->CanGetParticipantWithIpAddress(ip_address))
  {
    return GetGroups()->GetParticipantWithIpAddress(ip_address);
  }

  assert(GetGroups()->CanLetLogin(ip_address));

  const boost::shared_ptr<const Participant> new_participant
    = m_groups->LetLogin(ip_address);
  assert(new_participant);

  //Logging this event
  m_log->Login(new_participant);

  //New participants try to log in
  return new_participant;
}
Esempio n. 5
0
bool CPhilipsHue::GetStates()
{
	std::vector<std::string> ExtraHeaders;
	std::string sResult;

#ifdef DEBUG_PhilipsHue
	sResult= ReadFile("E:\\philipshue.json");
#else
	std::stringstream sstr2;
	sstr2 << "http://" << m_IPAddress
		<< ":" << m_Port
		<< "/api/" << m_UserName;
	//Get Data
	std::string sURL = sstr2.str();
	if (!HTTPClient::GET(sURL, ExtraHeaders, sResult))
	{
		_log.Log(LOG_ERROR, "Philips Hue: Error getting Light States, (Check IPAddress/Username)");
		return false;
	}
#endif
#ifdef DEBUG_PhilipsHue2
	SaveString2Disk(sResult, "E:\\philipshue.json");
#endif

	Json::Value root;

	Json::Reader jReader;
	bool ret = jReader.parse(sResult, root);
	if (!ret)
	{
		_log.Log(LOG_ERROR, "Philips Hue: Invalid data received, or invalid IPAddress/Username!");
		return false;
	}

	if (sResult.find("\"error\":") != std::string::npos)
	{
		//We had an error
		_log.Log(LOG_ERROR, "Philips Hue: Error received: %s", root[0]["error"]["description"].asString().c_str());
		return false;
	}


	if (!GetLights(root))
	{
		//_log.Log(LOG_ERROR, "Philips Hue: No Lights found!");
		return false;
	}
	GetGroups(root);
	GetScenes(root);
	return true;
}
void wxJigsawEditorDocument::ReCreateHotSpots(wxDC & dc, wxJigsawHotSpotArray & hotSpots, 
		wxJigsawShapeGroup * groupToSkip, double scale)
{
	hotSpots.Clear();
	for(wxJigsawShapeGroupList::Node * node = GetGroups().GetFirst(); node; node = node->GetNext())
	{
		wxJigsawShapeGroup * group = node->GetData();
		if(!group || (group == groupToSkip)) continue;
		group->ReCreateHotSpots(dc, hotSpots, scale);
	}
	wxLogTrace(wxTraceMask(), 
		_("wxJigsawEditorDocument::ReCreateHotSpots; Count =  %i"), 
		hotSpots.GetCount());
}
Esempio n. 7
0
void plProfileManagerFull::ILogStats()
{
    wchar_t statFilename[256];
    hsSnwprintf(statFilename, 256, L"%s%s.csv", GetProfilePath(), fLogAgeName.c_str());

    bool exists = plFileUtils::FileExists(statFilename);

    hsUNIXStream s;
    if (s.Open(statFilename, L"ab"))
    {
        GroupSet groups;
        GetGroups(groups);

        GroupSet::iterator it;

        if (!exists)
        {
            const char* kSpawn = "Spawn";
            s.Write(strlen(kSpawn), kSpawn);
            s.WriteByte(',');

            for (it = groups.begin(); it != groups.end(); it++)
            {
                plString groupName = *it;
                IPrintGroup(&s, groupName.c_str(), true);
            }
            s.WriteByte('\r');
            s.WriteByte('\n');
        }

        s.Write(fLogSpawnName.length(), fLogSpawnName.c_str());
        s.WriteByte(',');

        for (it = groups.begin(); it != groups.end(); it++)
        {
            plString groupName = *it;
            IPrintGroup(&s, groupName.c_str());
        }
        s.WriteByte('\r');
        s.WriteByte('\n');

        s.Close();
    }

    fLogStats = false;
    fLogAgeName = L"";
    fLogSpawnName = "";
}
Esempio n. 8
0
void CDConsoleDlg::OnBnClickedButtonSearch()
{
	// TODO: 在此添加控件通知处理程序代码
	bool bFlag = true;
	UpdateData(TRUE);
	if ("" == m_strSearch)
	{
		bFlag = false;
	}
	else
	{
		bFlag = true;
	}
	switch (m_cmbObjSel.GetCurSel())
	{
	case 0:
		{
			//clear DcUsers List
			m_DcUsers.DeleteAllItems();
			// 获取用户列表
			GetUsers(m_strSearch, bFlag);
		}
		break;
	case 1:
		{
			//clear DcGroups List
			m_DcGroups.DeleteAllItems();
			// 获取群组列表
			GetGroups(m_strSearch, bFlag);
		}
		break;
	case 2:
		{
			//clear PatchGroup List
			m_PatchGroups.DeleteAllItems();
			// 获取派接组列表
			GetPatchGroups(m_strSearch, bFlag);
		}
		break;
	default:
		;
	}
	// 触发状态上报
	ELTE_INT32 iRet = ELTE_SDK_TriggerStatusReport(1);
	CHECK_API_RETURN_VOID(iRet, _T("ELTE_SDK_TriggerStatusReport"));
}
Esempio n. 9
0
bool GroupCache::Populate()
{
  auto groups = GetGroups();
  
  std::lock(namesMutex, gidsMutex);
  std::lock_guard<std::mutex> namesLock(namesMutex, std::adopt_lock);
  std::lock_guard<std::mutex> gidsLock(gidsMutex, std::adopt_lock);

  gids.clear();
  names.clear();
  
  for (const auto& group : groups)
  {
    gids[group.name] = group.id;
    names[group.id] = group.name;
  }

  return true;
}
Esempio n. 10
0
string GetStringBySyntax(const CSentencesCollection& SC, const CAgramtab& A, string input)
{
	string Result;
	Result += Format("<chunk>\n");
	Result += Format("<input>%s</input>\n", input.c_str());
	for (size_t nSent = 0; nSent < SC.m_vectorSents.size(); nSent++)
	{
		const CSentence& Sentence = *SC.m_vectorSents[nSent];
		int iWord = 0, iClau = 0, iCvar = 0;
		Result += "<sent>\n";
		GetAnanlytForms(Sentence, Result);
		GetGroups(Sentence, A, Result);
		GetRelations(Sentence, Result);
		Result += "</sent>\n";
	}
	Result += Format("</chunk>\n");

	fprintf(stderr, "sentences count: %i\n", SC.m_vectorSents.size());
	return Result;
};
Esempio n. 11
0
void CDConsoleDlg::InitDlg()
{
	// 先清理
	ClearProv();

// 	GetDlgItem(IDC_BUTTON_PROVINIT)->EnableWindow(FALSE);
// 	GetDlgItem(IDC_BUTTON_PROVEXIT)->EnableWindow(TRUE);

	if(m_pCeLTE_SDSDlg && !((CeLTE_SDSDlg*)m_pCeLTE_SDSDlg)->m_bClose)
	{
		// 获取用户列表
		GetUsers(_T(""),false);
		// 获取群组列表
		GetGroups(_T(""),false);
		// 获取派接组列表
		GetPatchGroups(_T(""),false);

		// 触发状态上报
		ELTE_INT32 iRet = ELTE_SDK_TriggerStatusReport(1);
		CHECK_API_RETURN_VOID(iRet, _T("ELTE_SDK_TriggerStatusReport"));
	}
}
Esempio n. 12
0
void CVoxSQLite::GetContact( const char* username, Contact& c )
{
	CppSQLite3Buffer buf;
	buf.format( "SELECT * from Contact WHERE username = %Q;", username );

	try
	{
		CppSQLite3Statement stmt = m_db.compileStatement( (const char*)buf );

		int	nContactId = 0;
		CppSQLite3Query q = stmt.execQuery();

		//Process record set.
        while (!q.eof())
        {
			nContactId = q.getIntField(0);

//			c.setName		( q.getStringField(1) );
//			c.setNickname	( q.getStringField(2) );
//			c.setBirthday	( q.getStringField(3) );
//			c.setMergedContact( q.getStringField(3) );

			GetMergedContacts( username, c.getMergedContacts() );
			GetGroups		 ( username, c.getGroups() );
			GetProfile		 ( username, c );

			q.nextRow();
        }

		stmt.reset();
	}

	catch (CppSQLite3Exception& e)
	{
		e.errorCode();
	}
}
wxJigsawShape * wxJigsawEditorDocument::GetShapeFromPoint(wxDC & dc, const wxPoint & pos,
		wxJigsawShape::wxJigsawShapeHitTestInfo & info,
		wxJigsawShapeGroup * ignoreGroup, double scale)
{
	do
	{
		for(wxJigsawShapeGroupList::Node * groupNode = GetGroups().GetFirst();
			groupNode; groupNode = groupNode->GetNext())
		{
			wxJigsawShapeGroup * group = groupNode->GetData();
			if(!group) break;
			if(group == ignoreGroup) continue;
			wxJigsawShape * shape = group->GetShapeFromPoint(dc, pos, info, scale);
			if(shape)
			{
				return info.GetShape();
			}
		}
	}
	while(false);

	info.Clear();
	return NULL;
}
Esempio n. 14
0
bool  CRusFormatCaller::format_for_partic_clause(CGroup& G)
{
	int j;

	int i = get_main_word (G.m_iFirstWord);
	if (i != G.m_iFirstWord) return false;
	if (Wi.m_UnitType == EWord) return false;
	if (Wi.m_ClauseType != PARTICIPLE_T) return false;

	if (i == 0) return false;
	const CGroup& MaxGrp = get_maximal_group(i-1);

	for (j = MaxGrp.m_iLastWord; j >= MaxGrp.m_iFirstWord; j--)
	{
		assert(j != -1);

		if ( !Wj.is_morph_noun()) continue;
		if ( Wj.HasFlag(fl_ile)) continue;
		
		int m = -1;
		for (int f = 0; f < GetGroups().size(); f++)
			if (GetGroups()[f].m_iFirstWord <= j && GetGroups()[f].m_iLastWord == i-1)
			{
				m = f;
				break;
			}
		int varMainWrd; 
		if (m != -1)
			varMainWrd = GetGroups()[m].m_MainWordNo;
		else
			varMainWrd = j;


		if (		GetGramTab()->GleicheGenderNumberCase(Wi.m_type_gram_code, Wi.m_gramcodes, Wj.m_gramcodes ) 
			||		(		sent[MaxGrp.m_iFirstWord].HasFlag(fl_small_number)
						&&	((Wi.GetGrammems() &  ( (1 << rGenitiv)  | (1 << rPlural))) == ( (1 << rGenitiv)  | 	(1 << rPlural)) )
					)
			)
		 if (varMainWrd == j || j == i-1)
		 {
			G.m_GroupType = NOUN_PARTICIPLE;
			G.m_iLastWord = get_maximal_group(G.m_iFirstWord).m_iLastWord;
			if (varMainWrd == j && m != -1)
				G.m_iFirstWord = GetGroups()[m].m_iFirstWord;
			else
				G.m_iFirstWord = j;
			G.m_MainGroup.m_iFirstWord =  G.m_iFirstWord;
			if (varMainWrd == j && m != -1)
				G.m_MainGroup.m_iLastWord = GetGroups()[m].m_iLastWord;
			else
				G.m_MainGroup.m_iLastWord =  j;

			G.SetGrammems( Wj.GetGrammems() );

			for (m = GetGroups().size()-1; m >= 0; m--)
				if (   GetGroups()[m].m_iFirstWord < G.m_iFirstWord 
					&& GetGroups()[m].m_iLastWord == i-1
				   )
					m_GroupsToRebuild.push_back(GetGroups()[m]);
			return true;
		 }

		 if (m != -1 && GetGroups()[m].m_iLastWord == i-1)
		   if (GetGroups()[m].m_GroupType == SIMILAR_NOUN_GROUPS)
			   if (GetGramTab()->GleicheCase(Wi.m_gramcodes,Wj.m_gramcodes))
			{
				G.m_GroupType = NOUN_PARTICIPLE;
				G.m_iLastWord = G.m_iFirstWord;
				G.m_iFirstWord = GetGroups()[m].m_iFirstWord;
				G.m_MainGroup.m_iFirstWord =  GetGroups()[m].m_iFirstWord;
				G.m_MainGroup.m_iLastWord =  GetGroups()[m].m_iLastWord;
				G.SetGrammems( GetGroups()[m].GetGrammems() );
				for (m = GetGroups().size()-1; m >= 0; m--)
					if (GetGroups()[m].m_iFirstWord < G.m_iFirstWord && GetGroups()[m].m_iLastWord == i-1)
						m_GroupsToRebuild.push_back(GetGroups()[m]);
				return true;
			}		
	}

	return false;	
};
Esempio n. 15
0
void UserActions::Init()
{
	m_actionNames.clear();
	m_actionNames.push_back(_("none"));
	m_actionNames.push_back(_("highlight"));
	m_actionNames.push_back(_("notify login/out"));
	m_actionNames.push_back(_("ignore chat"));
	m_actionNames.push_back(_("ignore pm"));
	m_actionNames.push_back(_("autokick"));
	m_actionNames.push_back(_("notify hosted battle"));
	m_actionNames.push_back(_("notify status change"));

	m_configActionNames.clear();
	m_configActionNames.push_back(_T("none"));
	m_configActionNames.push_back(_T("highlight"));
	m_configActionNames.push_back(_T("notify_login"));
	m_configActionNames.push_back(_T("ignore_chat"));
	m_configActionNames.push_back(_T("ignore_pm"));
	m_configActionNames.push_back(_T("autokick"));
	m_configActionNames.push_back(_T("notify_hosted"));
	m_configActionNames.push_back(_T("notify_status"));

	m_actionTooltips.clear();
	m_actionTooltips.push_back(_("no action at all"));
	m_actionTooltips.push_back(_("highlight user in nick list and battles he participates in"));
	m_actionTooltips.push_back(_("popup a message box when user logs in/out from  the server"));
	m_actionTooltips.push_back(_("you won't see message by these users in normal channels"));
	m_actionTooltips.push_back(_("ignore private messages of these users, no pm window will open if any of these try to contact you privately"));
	m_actionTooltips.push_back(_("automatically kick users from battles hosted by yourself"));
	m_actionTooltips.push_back(_("popup a message box when user hosts a new battle"));
	m_actionTooltips.push_back(_("popup a message box when user changes away status"));

	// setup if empty
	if (!cfg().Exists(_T( "/Groups"))) {
		AddGroup(_("Default"));
		AddGroup(_("Ignore PM"));
		ChangeAction(_("Ignore PM"), UserActions::ActIgnorePM);
		AddGroup(_("Ignore chat"));
		ChangeAction(_("Ignore chat"), UserActions::ActIgnoreChat);
		AddGroup(_("Battle Autokick"));
		ChangeAction(_("Battle Autokick"), UserActions::ActAutokick);
		AddGroup(_("Friends"));
		ChangeAction(_("Friends"), UserActions::ActNotifBattle);
		ChangeAction(_("Friends"), UserActions::ActHighlight);
		ChangeAction(_("Friends"), UserActions::ActNotifLogin);
		// TODO select better color
		SetGroupColor(_("Friends"), wxColour(0, 0, 255));
	}


	// read
	m_groupNames = GetGroups();
	m_groupMap.clear();
	m_groupActions.clear();
	m_actionsGroups.clear();
	m_actionsPeople.clear();
	m_knownUsers.Clear();
	for (unsigned int i = 0; i < m_groupNames.GetCount(); ++i) {
		wxString name = m_groupNames[i];
		m_groupMap[name] = GetPeopleList(name);
		for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
			wxString user = m_groupMap[name][k];
			m_knownUsers.Add(user);
			m_peopleGroup[user] = name;
		}
		m_groupActions[name] = GetGroupActions(name);
	}
	for (size_t i = 0; i < m_actionNames.size(); ++i) {
		UserActions::ActionType cur = (UserActions::ActionType)(1 << i);
		wxArrayString tmp;
		for (unsigned int j = 0; j < m_groupNames.GetCount(); ++j) {
			wxString name = m_groupNames[j];
			if ((m_groupActions[name] & cur) != 0) {
				tmp.Add(name);
				for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
					m_actionsPeople[cur].Add((m_groupMap[name])[k]);
				}
			}
		}
		tmp.Sort();
		m_actionsGroups[cur] = tmp;
	}
	m_actionsGroups[ActNone] = m_groupNames;
	m_groupNames.Sort();
	m_knownUsers.Sort();
}
wxJigsawShapeGroup * wxJigsawEditorDocument::CreateGroupByShape(wxDC & dc, wxJigsawShape * shape)
{
	do
	{
		// If NULL was passed then exit
		if(!shape) break;
		// This will be a result
		wxJigsawShapeGroup * group(NULL);
		// Get parent of a shape
		wxJigsawShape * parent = shape->GetParent();
		// If shape does not have a parent
		if(!parent)
		{
			// Find group to which the shape belongs
			group = GetShapeGroup(shape);
			// If shape does not belong to any group then create a group for it
			if(!group)
			{
				// Create a group
				group = new wxJigsawShapeGroup();
				// Set the position of a group
				group->SetPosition(dc, wxRealPoint(shape->GetPosition().x, shape->GetPosition().y), 1.0);
				// Add shape to the group
				group->GetShapes().Append(shape);
				// Layout the group
				group->Layout(dc, 1.0);
			}
			else
			{
				// If shape belongs to group and it is not a first shape in group then we have 
				// to extract it and all shapes after it
				if(group->GetShapes().IndexOf(shape) > 0)
				{
					group = wxJigsawShapeGroup::CreateFromShapeList(dc, 
						group->GetShapes(),
						group->GetShapes().IndexOf(shape), 1.0);
				}
			}
			// Add group to list
			GetGroups().Append(group);
			RequestSizeRecalculation();
			// Return the group
			return group;
		}
		else
		{
			int indexInChildren = parent->GetChildren().IndexOf(shape);
			// If shape belongs to children
			if(indexInChildren >= 0)
			{
				group = wxJigsawShapeGroup::CreateFromShapeList(dc, 
					parent->GetChildren(),
					parent->GetChildren().IndexOf(shape),
					1.0);
				for(wxJigsawShapeList::Node * node = group->GetShapes().GetFirst(); node; node = node->GetNext())
				{
					wxJigsawShape * groupShape = node->GetData();
					groupShape->SetParent(NULL);
				}
			}
			else // If shape belongs to input parameters
			{
				for(wxJigsawInputParameters::Node * node = parent->GetInputParameters().GetFirst();
					node; node = node->GetNext())
				{
					wxJigsawInputParameter * param = node->GetData();
					if(!param) continue;
					if(param->GetShape() == shape)
					{
						param->SetShape(NULL);
						shape->SetParent(NULL);
						group = new wxJigsawShapeGroup;
						group->SetPosition(dc, shape->GetPosition(), 1.0);
						group->GetShapes().Append(shape);
						group->Layout(dc, 1.0);
					}
				}
			}
			// Add group to list
			GetGroups().Append(group);
			RequestSizeRecalculation();
			// Return a gruop
			return group;
		}
	}
	while(false);
	return NULL;
}
bool wxJigsawEditorDocument::ProcessDrop(wxDC & dc, const wxPoint & pos, 
		wxJigsawShapeGroup * group, const wxSize & hotSpotOffset, double scale)
{
	do
	{
		wxJigsawEditorView * view = wxDynamicCast(GetFirstView(), wxJigsawEditorView);
		if(!view) break;
		if(!group) break;
		if(GetGroups().IndexOf(group) < 0) break;
		wxJigsawShape::wxJigsawShapeHitTestInfo info;
		wxJigsawShape * shape = GetShapeFromPoint(dc, pos, info, group, scale);
		if(!shape) break;
		bool isSingleShape = (group->GetShapes().GetCount() == 1);
		bool isParamShape = false;
		if(isSingleShape)
		{
			wxJigsawShapeList::Node * node = group->GetShapes().GetFirst();
			if(node)
			{
				wxJigsawShape * firstShape = node->GetData();
				if(firstShape)
				{
					isParamShape = (firstShape->GetStyle() != wxJigsawShapeStyle::wxJS_TYPE_DEFAULT);
				}
			}
		}
		/// If user dropped the group on the slot
		if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_SLOT)
		{
			if(!info.GetShape()) break;
			// Group should have conly one element to be added to the slot
			if(group->GetShapes().GetCount() != 1) break;
			wxJigsawInputParameters::Node * paramNode = 
				info.GetShape()->GetInputParameters().Item(info.GetInputParameterIndex());
			if(!paramNode) break;
			wxJigsawInputParameter * param = paramNode->GetData();
			if(!param) break;
			wxJigsawShapeList::Node * insertShapeNode = group->GetShapes().Item(0);
			if(!insertShapeNode) break;
			wxJigsawShape * insertShape = insertShapeNode->GetData();
			if(!insertShape) break;
			if((param->GetStyle() != insertShape->GetStyle()) || 
				(insertShape->GetStyle() == wxJigsawShapeStyle::wxJS_TYPE_NONE)) break;
			group->Detach(insertShape);
			insertShape->SetParent(info.GetShape());
			param->SetShape(insertShape);
			GetGroups().DeleteObject(group);
			//info.GetShape()->RequestSizeRecalculation();
			//UpdateLayout(view->GetScale());
			//wxDELETE(group);
		}
		else if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_C_SHAPE_BUMP)
		{
			if(isParamShape) break;
			AppendChildren(info.GetShape(), group, 0);
		}
		else if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_C_SHAPE_NOTCH)
		{
			if(isParamShape) break;
			AppendChildren(info.GetShape(), group, info.GetShape()->GetChildren().GetCount());
		}
		else if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_CHILD_INSERTION_AREA)
		{
			if(isParamShape) break;
			AppendChildren(info.GetShape(), group, info.GetChildIndex());
		}
		else if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_BUMP_DOCKING_AREA)
		{
			if(isParamShape) break;
			wxJigsawShapeGroup * targetGroup = GetShapeGroup(info.GetShape());
			if(!targetGroup) break;
			if(!InsertGroup(targetGroup, group, 
				targetGroup->GetShapes().IndexOf(info.GetShape())+1))
			{
				break;
			}
			//group->GetShapes().Insert(group->GetShapes().IndexOf(info.GetShape()), info.GetShape())
			GetGroups().DeleteObject(group);
		}
		else if(info.GetResult() == wxJigsawShape::wxJS_HITTEST_NOTCH_DOCKING_AREA)
		{
			if(isParamShape) break;
			wxJigsawShapeGroup * targetGroup = GetShapeGroup(info.GetShape());
			if(!targetGroup) break;
			if(!InsertGroup(targetGroup, group, 
				targetGroup->GetShapes().IndexOf(info.GetShape())))
			{
				break;
			}
			//group->GetShapes().Insert(group->GetShapes().IndexOf(info.GetShape()), info.GetShape())
			GetGroups().DeleteObject(group);
		}
		UpdateLayout(dc, view->GetScale());
		UpdateAllViews();
		return true;
	}
	while(false);
	return false;
}
Esempio n. 18
0
bool  CRusFormatCaller::format_for_whose_clause(CGroup& G) //правило построения группы с придаточным определительным;	
{
	int j;
	int i = get_main_word (G.m_iFirstWord);
	if (i != G.m_iFirstWord) return false;
	if (Wi.m_UnitType == EWord) return false;
	if (!Wi.HasFlag(fl_relative_clause)) return false;

	if (i == 0) return false;
	const CGroup& MaxGrp = get_maximal_group(i-1);

	for (j = MaxGrp.m_iLastWord; j >= MaxGrp.m_iFirstWord; j--)
	{
		assert(j != -1);
		if ( !Wj.is_morph_noun()) continue;

		
		int m = -1;
		for (int f = 0; f < GetGroups().size(); f++)
			if (GetGroups()[f].m_iFirstWord <= j && GetGroups()[f].m_iLastWord == i-1)
			{
				m = f;
				break;
			}
		int varMainWrd; 
		if (m != -1)
			varMainWrd = GetGroups()[m].m_MainWordNo;
		else
			varMainWrd = j;

		if ( GetGramTab()->GleicheGenderNumber(Wi.m_gramcodes, Wj.m_gramcodes ) )
		 if (varMainWrd == j || j == i-1)
		 {
			G.m_GroupType = WHOSE_SUBORDINATE;
			G.m_iLastWord = G.m_iFirstWord;
			if (varMainWrd == j && m != -1)
				G.m_iFirstWord = GetGroups()[m].m_iFirstWord;
			else
				G.m_iFirstWord = j;
			G.m_MainGroup.m_iFirstWord =  G.m_iFirstWord;
			if (varMainWrd == j && m != -1)
				G.m_MainGroup.m_iLastWord = GetGroups()[m].m_iLastWord;
			else
				G.m_MainGroup.m_iLastWord =  j;
			G.SetGrammems( Wj.GetGrammems() );
			for (m = GetGroups().size()-1; m >= 0; m--)
			{

				if (GetGroups()[m].m_iFirstWord < G.m_iFirstWord && GetGroups()[m].m_iLastWord == i-1)
					m_GroupsToRebuild.push_back(GetGroups()[m]);
			};
			return true;
		 }

		 if (m != -1 && GetGroups()[m].m_iLastWord == i-1)
		   if (GetGroups()[m].m_GroupType == SIMILAR_NOUN_GROUPS)
			if (GetGramTab()->GleicheCase(Wi.m_gramcodes, Wj.m_gramcodes) )
			{
				G.m_GroupType = WHOSE_SUBORDINATE;
				G.m_iLastWord = G.m_iFirstWord;
				G.m_iFirstWord = GetGroups()[m].m_iFirstWord;
				G.m_MainGroup.m_iFirstWord =  GetGroups()[m].m_iFirstWord;
				G.m_MainGroup.m_iLastWord =  GetGroups()[m].m_iLastWord;
				G.SetGrammems ( GetGroups()[m].GetGrammems() );
				for (m = GetGroups().size()-1; m >= 0; m--)
					if (GetGroups()[m].m_iFirstWord < G.m_iFirstWord && GetGroups()[m].m_iLastWord == i-1)
						m_GroupsToRebuild.push_back(GetGroups()[m]);
				return true;
			}		
	}

	return false;	
};
	/**
	 *  @glsymbols
	 *  @glfunref{GetPerfMonitorGroupsAMD}
	 */
	std::vector<PerfMonitorAMDGroup> GetGroups(void) const
	{
		std::vector<PerfMonitorAMDGroup> result;
		GetGroups(result);
		return result;
	}
Esempio n. 20
0
bool CRusFormatCaller::format_for_noun_groups (CGroup& G)
{
	const CGroup& FirstChild = get_maximal_group(G.m_iFirstWord);
	if (FirstChild.m_iFirstWord != G.m_iFirstWord) return false;
	int i =  get_main_word_in_group(FirstChild);
	if (!is_left_noun_modifier (Wi)) return false;
	if( Wi.is_lemma("КОТОРЫЙ") )
	  		return false;
	string debug_str;
	bool bFound_VSE = false; //слово "всe" начинает группу
	bool bFoundParticiple = false; //нашли дст., пе, причастие
	bool bAdjShouldBeInNominativOrGenitiv = false; //чтобы собрать "две красивых девочки"
	//gleiche_for_small_numbers
	int NounGroupNo;

	if(		Wi.get_upper_word()
		&&	!strcmp(Wi.get_upper_word(), "ВСЕ")
		&&    Wi.is_lemma("ВЕСЬ")
		&&	(get_maximal_group_size(i) == 1)
		)
	bFound_VSE = true;

	if	(		Wi.has_grammem(rActiveVoice)
			&&	Wi.has_grammem(rTransitive)
            &&  Wi.HasPOS(PARTICIPLE) 
		)
		bFoundParticiple = true;

  

  
	if ((G.m_iFirstWord+1) >= sent.size()) return false;

	// собираем группу "сам себя"
	int j;
	if (    Wi.is_lemma( "САМ") )
	{
		G.m_iLastWord = get_maximal_group(G.m_iFirstWord).m_iLastWord + 1; 
		if (G.m_iLastWord < sent.size())
		{
			NounGroupNo = get_maximal_group_no(G.m_iLastWord);		
            j = (NounGroupNo == -1 ) ? G.m_iLastWord : GetGroups()[NounGroupNo].m_MainWordNo;
			if (   Wj.is_lemma("СЕБЯ") 
				|| Wj.is_lemma("ТЫ") 
				|| Wj.is_lemma("Я") 
				|| Wj.is_lemma("МЫ")  // "сами мы не местные"
				)
				if ((Wi.GetGrammems() & Wj.GetGrammems() & rAllCases) > 0)
				{
					i = j;
					G.SetGrammems (Wi.GetGrammems() & Wj.GetGrammems() & (rAllCases | rAllGenders));
					goto CreateGroup;
				};
		};
	};
	   

	// нахождение последовательности П1 ... Пn С, где Пi - прилагательное или группа прилагательных,
	// а С - ИГ.
	// Согласование по падежу, числу и роду будет проверяться в другом цикле.
	G.SetGrammems ( Wi.GetGrammems() );
	for (	G.m_iLastWord = get_maximal_group(G.m_iFirstWord).m_iLastWord + 1; 
			G.m_iLastWord < sent.size(); 
			G.m_iLastWord  = get_maximal_group(G.m_iLastWord).m_iLastWord + 1 
		)
	{

			int i_gr = get_maximal_group_no(G.m_iLastWord);		
            i = (i_gr == -1) ? G.m_iLastWord:GetGroups()[i_gr].m_MainWordNo;

			if( Wi.is_lemma("КОТОРЫЙ") )
	  			return false;

			if( i_gr != -1 ) 
			{
				G.SetGrammems (G.GetGrammems() &  GetGroups()[i_gr].GetGrammems());
			}
			else
			{
				G.SetGrammems( G.GetGrammems() & Wi.GetGrammems() );
				if( GetGramTab()->IsSimpleParticle(Wi.get_lemma(), Wi.GetPoses()) && (i > G.m_iFirstWord) )			
					continue;
				
			}

			if ( !is_left_noun_modifier (Wi)) break;

			if	(		Wi.has_grammem(rActiveVoice) 
					&&	Wi.has_grammem(rTransitive) 
					&&	Wi.HasPOS(PARTICIPLE) 
				)
				bFoundParticiple = true;
		
	}; //  end of for by  "G.m_iLastWord"


	if (G.m_iLastWord < sent.size())
		G.m_iLastWord = get_maximal_group(G.m_iLastWord).m_iLastWord;

	/*
		если дошли до конца или в конце не стоит существительного 
		тогда пробуем собрать группу "все это" ("это" - не является синтаксическим cуществительным)
			или группу "все лишнее"
	*/
	if (G.m_iLastWord >= sent.size() || !Wi.is_syn_noun())
	{
		//  если самое первое слово ИГ было "всe"
		if( bFound_VSE )
		{
			// возвращаемся на одно слово назад
			G.m_iLastWord--;	
			if( G.size() != 2 )
				return false;
			i = G.m_iLastWord;
			if( ( get_maximal_group_size(i) == 1) && GetGramTab()->IsSimpleParticle(Wi.get_lemma(), Wi.GetPoses()) )
				G.m_iLastWord++;

			if (G.m_iLastWord >= sent.size()) return false;

			if( get_maximal_group_size(G.m_iLastWord) > 1)
				return false;

			if( sent[G.m_iLastWord].m_UnitType != EWord)
				return false;

			i = get_main_word(G.m_iLastWord);			
		
			if( !is_left_noun_modifier (Wi) )	 
				return false;

			if( !is_left_noun_modifier (Wi) )	 
				return false;
		}
		else
			return false;
	}



	if( bFoundParticiple )
		if( (Wi.GetGrammems() & _QM(rAccusativ)) && (G.GetGrammems() & _QM(rAccusativ)) )
			return false;
  

	// Берем группу, которая могла быть построена на найденном существительном,
	// группа может прийти из тезауруса или ЧИСЛ-СУЩ, например: "первые пять человек",

	size_t FirstWordOfNounGroup;  
	NounGroupNo = get_maximal_group_no(i);
	if( NounGroupNo != -1)
	{
		FirstWordOfNounGroup = GetGroups()[NounGroupNo].m_iFirstWord;
		G.SetGrammems ( GetGroups()[NounGroupNo].GetGrammems() );
	}
	else
	{
		FirstWordOfNounGroup = i;
		G.SetGrammems( Wi.GetGrammems() );
	};

	if( G.m_iFirstWord > 0 )
	{
		QWORD dummy;
		//gleiche_for_plural_numbers(i, G.m_iFirstWord - 1, false, dummy, bAdjShouldBeInNominativOrGenitiv, is_small_number_group(G.m_iFirstWord - 1));		  
	}

	if ( sent[G.m_iFirstWord].HasFlag(fl_digit) && sent[G.m_iFirstWord].HasPOS(NUMERAL_P) && sent[FirstWordOfNounGroup].HasFlag(fl_ile) ) // "вызвать 5 API"
		return false;

	// Согласование по падежу, числу и роду проверяться здесь.
	for (j = G.m_iFirstWord; j <  FirstWordOfNounGroup; j = get_maximal_group(j).m_iLastWord + 1)
	{
		const CGroup& LastHost = get_maximal_group(j);
		int  MainWordNo = LastHost.m_MainWordNo;

		if( (LastHost.size() == 1) && GetGramTab()->IsSimpleParticle(Wj.get_lemma(), Wj.GetPoses()) )				
				continue;



		if ( !bAdjShouldBeInNominativOrGenitiv )
		{
			//  проверяем согласование между прилагательным и существительным
			QWORD CommonGrams = GetGramTab()->GleicheGenderNumberCase(Wi.m_type_gram_code, Wi.m_gramcodes, sent[MainWordNo].m_gramcodes); 
			if (!CommonGrams)
				if	(		NounGroupNo != -1 
						&& GetGroups()[NounGroupNo].m_GroupType == NUMERAL_NOUN
						&& (sent[MainWordNo].GetGrammems() &  G.GetGrammems() & rAllNumbers)					
						&& (sent[MainWordNo].GetGrammems() &  G.GetGrammems() & rAllCases)
					) 
					CommonGrams = sent[MainWordNo].GetGrammems();
				else
					return false;
				


			//  если главный элемент в ПРИЛ_СУЩ является однородным рядом, тогда нужно проверить, что
			//  данное прилагательное согласовано со всеми членами однородного ряда по падежу (по числу и роду может быть не согласовано)
			//  иначе вся фразы "Советской гавани, он" покрывается одним ПРИЛ_СУЩ 
			if (NounGroupNo != -1)
				if (GetGroups()[NounGroupNo].m_GroupType == SIMILAR_NOUN_GROUPS)
					if ( (Wi.GetGrammems() & GetGroups()[NounGroupNo].GetGrammems() & rAllCases) == 0)
						return false;

			G.SetGrammems( G.GetGrammems() & CommonGrams);
		}
		else
		{
			if	(			(			!(sent[MainWordNo].GetGrammems() &  _QM(rGenitiv))	
									&&	!(sent[MainWordNo].GetGrammems() &  _QM(rNominativ)) 
							)
						||	!(	sent[MainWordNo].GetGrammems() &  _QM(rPlural)) 
					
				)
					return false;				

			G.SetGrammems(G.GetGrammems() & sent[MainWordNo].GetGrammems());
		};

		
	}  // end of cycle by "j"

	if( bAdjShouldBeInNominativOrGenitiv )
		if( NounGroupNo == -1 )
			G.SetGrammems( Wi.GetGrammems());
		else
			G.SetGrammems( GetGroups()[NounGroupNo].GetGrammems() );


	debug_str = GetGramTab()->GrammemsToStr(G.GetGrammems());
	debug_str = GetGramTab()->GrammemsToStr(W2.GetGrammems());

	G.m_Cause = "ИГ, согласованная по роду, числу и падежу";

	if (is_morph_pronoun(Wi)) return false; 


CreateGroup:

	if ((G.GetGrammems() & rAllNumbers) == _QM(rSingular))
		change_words_in_group_grammems(G, G.GetGrammems(), (rAllNumbers | rAllGenders | rAllCases));  
	else
		change_words_in_group_grammems(G, G.GetGrammems(), (rAllNumbers | rAllCases));  

	G.m_MainGroup =  get_maximal_group(i);
	debug_str = GetGramTab()->GrammemsToStr(W2.GetGrammems());
	G.m_iLastWord = G.m_MainGroup.m_iLastWord;
	G.m_GroupType = NOUN_ADJ;
	debug_str = GetGramTab()->GrammemsToStr(G.GetGrammems());
  
    {
        size_t k  = G.m_iFirstWord; 
        size_t last = get_maximal_group(G.m_iLastWord).m_iFirstWord;
        while (k < last)
        {	
            const CGroup& H = get_maximal_group(k);
            create_syn_rel(G, i, H.m_MainWordNo, NOUN_ADJ);           		
            k += H.size();
        }

    }

	return true;
};
int main(int argc, char * argv[]) 
{
	PARSE_ARGS;
////////////////////////////////////////////////////////////////////////////////////////////////////////Pipipeline 1//////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
	std::string nameFile;
	nameFile="/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/dataset.csv";	
	std::ifstream Sub(nameFile.c_str(),std::ios::in);
	int i=0;
	if(Sub)
	{
		std :: string line;
		
		while(getline( Sub, line ))
		{  std :: cout <<"1"<<endl;

			if (i>0)
			{
				char labelfile[200];  
				char subjid[100];
				char WarpedCorrespondenceMesh[200];
				char CorrespondenceMesh[200];
						
				char labelMapInput[200];
				char measurementOutput[200];
				char group[100];
				char ThicknessSamplingResult[200];
		
				/*std :: string labelfile;  
				std :: string subjid;
				std :: string WarpedCorrespondenceMesh;
				std :: string CorrespondenceMesh;
						
				std :: string labelMapInput;
				std :: string measurementOutput;
				std :: string group;
				std :: string ThicknessSamplingResult;*/
				
				std::string BatchMakeScriptFile = "slicer3ThicknessSPHARM.bms";
				std::ofstream file( BatchMakeScriptFile.c_str());

				readFileCSV(line, group,subjid,labelMapInput, measurementOutput,labelfile, CorrespondenceMesh, WarpedCorrespondenceMesh, ThicknessSamplingResult);
			

				//std :: cout << "s is : " << group << std :: endl;
				file <<"set (labelMapInput "<< labelMapInput<<")"<<std::endl;
				file <<"set (measurementOutput "<< measurementOutput<<")"<<std::endl;
				file <<"set (spharmBinaryInput "<<labelfile<<")"<<std::endl;
				file <<"set (case1 "<< subjid <<")"<<std::endl;
				file <<"set (group "<< group <<")"<<std::endl;
				file <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
				file <<"set (exprId "<< exprId<<")"<<std::endl;

				file <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/ThicknessSpharm.bms)"<<std::endl;

				file.close();
				/*
				bm::ScriptParser m_Parser;
				
				m_Parser.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
				m_Parser.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
				m_Parser.Execute(BatchMakeScriptFile); 
				*/
			}
			i++;
		}
		Sub.close();
	} // fin du if (sub)
	else
	{
	      std::cout << "ERROR: Unable  to open file for reading." << std::endl;

	}
///////////////////////////////////////////////////////////////////////////////////////////////////////Pipeline2///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	std::string nameFile2;
	nameFile2=dataset;	
	int number_of_groups = GetNumberGroups(nameFile2);
	number_of_groups = number_of_groups - 1; // First line isn't a group name
 	



	//Initialisation
	char** groupIds = new char*[number_of_groups];
  	for(int i = 0; i < number_of_groups; ++i) groupIds[i] = NULL;
  
	char** Groups = new char*[number_of_groups];
  	for(int i = 0; i < number_of_groups; ++i) Groups[i] = NULL;

	char** subjgroups = new char*[number_of_groups];
  	for(int i = 0; i < number_of_groups; ++i) subjgroups[i] = NULL;
  
  	int L = GetGroups(nameFile2, groupIds, subjgroups, Groups);  
  	for(int i = 0; i < L; ++i) std::cout << groupIds[i] << std::endl;  
  	for(int i = 0; i < number_of_groups; ++i) std::cout << subjgroups[i] << std::endl;
	for(int i = 0; i < number_of_groups; ++i) std::cout << Groups[i] << std::endl;
  	
std::string final_groups;
	std::string subjGroup;
  	for(int i = 0; i < L; ++i)
  	{
   		 if (i != L-1) final_groups = final_groups + groupIds[i] + ' ';
    		else final_groups = final_groups + groupIds[i];
 	 }
  for(int i = 0; i < number_of_groups; ++i)
  	{
   		 if (i != number_of_groups-1) subjGroup = subjGroup + subjgroups[i] +'/'+ Groups[i] + ' ';
    		else subjGroup = subjGroup + subjgroups[i] +'/'+ Groups[i];
 	 }
  	//std::cout << final_groups << std::endl;
std::cout << subjGroup << std::endl;


//file bms
	std::string BatchMakeScriptFile2 = "slicer3ThicknessSPHARM1.bms";
	std::ofstream file2( BatchMakeScriptFile2.c_str());
 
	file2 <<"set (groupIds "<< final_groups<<")"<<std::endl;
	file2 <<"set (subjectsWithGroups "<< subjGroup<<")"<<std::endl;
	file2 <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
	file2 <<"set (exprId "<< exprId<<")"<<std::endl;

	file2 <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/particlecorrespondance.bms)"<<std::endl;

	file2.close();  
/*
	bm::ScriptParser m_Parser1;
	m_Parser1.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
	m_Parser1.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
	m_Parser1.Execute(BatchMakeScriptFile2);
*/


////////////////////////////////////////////////////////////////////////////////////////////////////////Pipeline 3/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

std::string nameFile3;
	nameFile3=dataset;	
	std::ifstream Sub1(nameFile.c_str(),std::ios::in);
	int i1=0;
	if(Sub1)
	{
		std :: string line;
		while(getline( Sub1, line ))
		{  
			if (i1>0)
			{
				char labelfile[200];  
				char subjid[100];
				char WarpedCorrespondenceMesh[200];
				char CorrespondenceMesh[200];
				char labelMapInput[200];
				char measurementOutput[200];
				char group[100];
				char ThicknessSamplingResult[200];

				std::string BatchMakeScriptFile = "slicer3writefile.bms";
				std::ofstream file( BatchMakeScriptFile.c_str());

				readFileCSV(line, group, subjid, labelMapInput, measurementOutput, labelfile, CorrespondenceMesh, WarpedCorrespondenceMesh, ThicknessSamplingResult);


				file <<"set (labelMapInput "<< labelMapInput<<")"<<std::endl;
				file <<"set (measurementOutput "<< measurementOutput<<")"<<std::endl;
				file <<"set (spharmBinaryInput "<<labelfile<<")"<<std::endl;
				file <<"set (case1 "<< subjid <<")"<<std::endl;
				file <<"set (CorrespondenceMesh "<<CorrespondenceMesh<<")"<<std::endl;
				file <<"set (WarpedCorrespondenceMesh  "<<WarpedCorrespondenceMesh<<")"<<std::endl;
				file <<"set (group "<< group <<")"<<std::endl;
				file <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
				file <<"set (exprId "<< exprId<<")"<<std::endl;

				file <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/writefile.bms)"<<std::endl;

				file.close();
				/*
				bm::ScriptParser m_Parser;

				m_Parser.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
				m_Parser.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
				m_Parser.Execute(BatchMakeScriptFile); 
				*/
			}
			i1++;
		}
		Sub1.close();
	} // fin du if (sub)
	else
	{
	      std::cout << "ERROR: Unable  to open file for reading." << std::endl;

	}

//////////////////////////////////////////////////////////////////////////////////////////////////Pipeline4////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::string nameFile4;
	nameFile4=dataset;	

//file bms
	std::string BatchMakeScriptFile4 = "slicer3shapeworks.bms";
	std::ofstream file4( BatchMakeScriptFile4.c_str());
 
	file4 <<"set (groupIds "<< final_groups<<")"<<std::endl;
	file4 <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
	file4 <<"set (exprId "<< exprId<<")"<<std::endl;

	file4 <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/shapeworks.bms)"<<std::endl;

	file4.close();  
/*
	bm::ScriptParser m_Parser4;
	m_Parser4.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
	m_Parser4.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
	m_Parser4.Execute(BatchMakeScriptFile4);
*/

////////////////////////////////////////////////////////////////////////////////////////////////Pipeline5/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
std::string nameFile5;
	nameFile5=dataset;	
	std::ifstream Sub2(nameFile.c_str(),std::ios::in);
	int i2=0;
	if(Sub2)
	{
		std :: string line;
		while(getline( Sub2, line ))
		{  
			if (i2>0)
			{
				char labelfile[200];  
				char subjid[100];
				char WarpedCorrespondenceMesh[200];
				char CorrespondenceMesh[200];		
				char labelMapInput[200];
				char measurementOutput[200];
				char group[100];
				char ThicknessSamplingResult[200];
				
				std::string BatchMakeScriptFile5 = "slicer3meshintensity.bms";
				std::ofstream file( BatchMakeScriptFile5.c_str());

				readFileCSV(line, group, subjid, labelMapInput, measurementOutput, labelfile, CorrespondenceMesh, WarpedCorrespondenceMesh, ThicknessSamplingResult);
		

				file <<"set (labelMapInput "<< labelMapInput<<")"<<std::endl;
				file <<"set (measurementOutput "<< measurementOutput<<")"<<std::endl;
				file <<"set (spharmBinaryInput "<<labelfile<<")"<<std::endl;
				file <<"set (case1 "<< subjid <<")"<<std::endl;
				file <<"set (CorrespondenceMesh "<<CorrespondenceMesh<<")"<<std::endl;
				file <<"set (WarpedCorrespondenceMesh  "<<WarpedCorrespondenceMesh<<")"<<std::endl;
				file <<"set (ThicknessSamplingResult  "<<ThicknessSamplingResult<<")"<<std::endl;
				file <<"set (group "<< group <<")"<<std::endl;
				file <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
				file <<"set (exprId "<< exprId<<")"<<std::endl;

				file <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/meshintensity.bms)"<<std::endl;

				file.close();
				/*
				bm::ScriptParser m_Parser;

				m_Parser.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
				m_Parser.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
				m_Parser.Execute(BatchMakeScriptFile5); 
				*/
			}
			i2++;
		}
		Sub2.close();
	} // fin du if (sub)
	else
	{
	      std::cout << "ERROR: Unable  to open file for reading." << std::endl;

	}
///////////////////////////////////////////////////////////////////////////////////////////////////////Pipeline6///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	std::string nameFile1;
	nameFile1=dataset;	

	//file bms
	std::string BatchMakeScriptFile1 = "slicer3ThicknessSPHARM2.bms";
	std::ofstream file6( BatchMakeScriptFile1.c_str());
 
	file6 <<"set (groupIds "<< final_groups<<")"<<std::endl;
	file6 <<"set (subjWorkDir "<< subjWorkDir<<")"<<std::endl;
	file6 <<"set (exprId "<< exprId<<")"<<std::endl;
	file6 <<"set (subjectsWithGroups "<< subjGroup<<")"<<std::endl;
	file6 <<"include (/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/correspondance.bms)"<<std::endl;

	file6.close();  
/*
	bm::ScriptParser m_Parser2;
	m_Parser2.LoadWrappedApplication( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" );
	m_Parser2.SetBatchMakeBinaryPath( "/biomed-resimg/work/mjacquem/Slicer3Thickness2/SampleBatchMake/bmm2" ); 
	m_Parser2.Execute(BatchMakeScriptFile1);
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 // Memory Space liberation
  	for (int i = 0; i < L; ++i) delete [] groupIds[i];
  	delete [] groupIds;

 // Memory Space liberation
  	for (int i = 0; i < number_of_groups; ++i) delete [] subjgroups[i];
  	delete [] subjgroups;
 // Memory Space liberation
  	for (int i = 0; i < number_of_groups; ++i) delete [] Groups[i];
  	delete [] Groups;
	
return 0;
	
}