Пример #1
0
int server::loadConfig(config * config1) {
    role    = sds(config1->getValueForString("role").c_str());
    ip      = sds(config1->getValueForString("ip").c_str());
    port    = config1->getValueInt("port");
    zk      = sds(config1->getValueForString("zk").c_str());
    id      = config1->getValueInt("id");
    dataDir =  sds(config1->getValueForString("datadir").c_str());
    logDir  =  sds(config1->getValueForString("logdir").c_str());
    logger  =  new Logger(logDir.buff);
    logger->setLogLevel(0);
    display();
}
Пример #2
0
void MkLineShape::__FillVertexData(MkByteArray& buffer) const
{
	// color
	D3DCOLOR color = static_cast<D3DCOLOR>(m_Color.ConvertToD3DCOLOR());

	// build data
	MkArray<SegmentData> sds(__GetVertexDataBlockSize());

	unsigned int cnt = m_Indices.GetSize();
	for (unsigned int i=0; i<cnt; i+=2)
	{
		SegmentData& sd = sds.PushBack();

		const MkFloat2& begin = m_WorldVertices[m_Indices[i]];
		const MkFloat2& end = m_WorldVertices[m_Indices[i + 1]];

		sd.begin.position.x = begin.x;
		sd.begin.position.y = begin.y;
		sd.begin.position.z = m_WorldDepth;
		sd.begin.color = color;

		sd.end.position.x = end.x;
		sd.end.position.y = end.y;
		sd.end.position.z = m_WorldDepth;
		sd.end.color = color;
	}

	MkByteArrayHelper<SegmentData>::PushBack(buffer, sds);
}
Пример #3
0
//+---------------------------------------------------------------------------
//
//  Member:     CRichtextLayout::DrawClient
//
//  Synopsis:   Draw client rect part of the controls
//
//  Arguments:  prcBounds       bounding rect of display leaf node
//              prcRedraw       rect to be redrawn
//              pSurface        surface to render into
//              pDispNode       pointer to display node
//              pClientData     client-dependent data for drawing pass
//              dwFlags         flags for optimization
//
//----------------------------------------------------------------------------
void CRichtextLayout::DrawClient(
            const RECT*     prcBounds,
            const RECT*     prcRedraw,
            CDispSurface*   pDispSurface,
            CDispNode*      pDispNode,
            void*           cookie,
            void*           pClientData,
            DWORD           dwFlags)
{
    Assert(pClientData);

    CFormDrawInfo* pDI = (CFormDrawInfo*)pClientData;

    {
        // we set draw surface information separately for Draw() and
        // the stuff below, because the Draw method of some subclasses
        // (like CFlowLayout) puts pDI into a special device coordinate
        // mode
        CSetDrawSurface sds(pDI, prcBounds, prcRedraw, pDispSurface);
        Draw(pDI);
    }

    {
        // see comment above
        CSetDrawSurface sds(pDI, prcBounds, prcRedraw, pDispSurface);

        // We only want to paint selection on the client rect in this part
        // In RTL the scrollbar is on the left and will leave extra highlighting
        // on the right side of the control if we do not adjust it here
        if(_fTextSelected)
        {
            DrawTextSelectionForRect(pDI->GetDC(), (CRect*)prcRedraw , &pDI->_rcClip, _fSwapColor);
        }

        if(GetView()->IsFlagSet(CView::VF_ZEROBORDER))
        {
            CLayout* pParentLayout = GetUpdatedParentLayout();
            if(pParentLayout && pParentLayout->ElementOwner()->IsEditable())
            {
                DrawZeroBorder(pDI);
            }
        }
    }
}
Пример #4
0
 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
 cov_matrix_constrain_lkj(const Eigen::Matrix<T, Eigen::Dynamic, 1>& x,
                      size_t k) {
   size_t k_choose_2 = (k * (k - 1)) / 2;
   Eigen::Array<T, Eigen::Dynamic, 1> cpcs(k_choose_2);
   int pos = 0;
   for (size_t i = 0; i < k_choose_2; ++i)
     cpcs[i] = corr_constrain(x[pos++]);
   Eigen::Array<T, Eigen::Dynamic, 1> sds(k);
   for (size_t i = 0; i < k; ++i)
     sds[i] = positive_constrain(x[pos++]);
   return read_cov_matrix(cpcs, sds);
 }
Пример #5
0
BOOL CGenericATAController::EnumerateDevices(PSP_DEVINFO_DATA pDevInfoData)
{
	
	CDeviceSetup controller(pDevInfoData);

	//primary device
	SP_DEVINFO_DATA pcDevInfoData;
	controller.GetChild(&pcDevInfoData);
	
	//primary ide channel
	CDeviceSetup primaryChannel(pcDevInfoData);
	
	//primary device
	SP_DEVINFO_DATA pdDevInfoData;
	
	if(primaryChannel.GetChild(&pdDevInfoData)!=0)
	{

		CDeviceSetup pds(pdDevInfoData);
		CATADevice *device=new CGenericATADevice(pds.GetDevicePath().c_str(),*this);
		m_deviceList.push_back(device);
		m_ataDeviceList.push_back(device);
	}

	
	//secondary device
	SP_DEVINFO_DATA scDevInfoData;
	primaryChannel.GetSibling(&scDevInfoData);

	//secondary ide channel
	CDeviceSetup secondaryChannel(scDevInfoData);

	SP_DEVINFO_DATA sdDevInfoData;
	
	if(secondaryChannel.GetChild(&sdDevInfoData)!=0)
	{
		CDeviceSetup sds(sdDevInfoData);
		CATADevice *device=new CGenericATADevice(sds.GetDevicePath().c_str(),*this);
		m_deviceList.push_back(device);
		m_ataDeviceList.push_back(device);
	}
		
				
	return 1;
}
Пример #6
0
//+====================================================================================
//
// Method: Draw
//
// Synopsis: Wraps call to IElementAdorner.Draw - to allow adorner
//           to draw.
//
//------------------------------------------------------------------------------------
void CFocusAdorner::DrawClient(
	   const RECT*		prcBounds,
	   const RECT*		prcRedraw,
	   CDispSurface*	pDispSurface,
	   CDispNode*		pDispNode,
	   void*			cookie,
	   void*			pClientData,
	   DWORD			dwFlags)
{
	Assert(_pElement);
    if(!_pElement->IsEditable(TRUE) && _pView->Doc()->HasFocus()
        && !(_pView->Doc()->_wUIState&UISF_HIDEFOCUS))
    {
		Assert(pClientData);

		CFormDrawInfo* pDI = (CFormDrawInfo*)pClientData;
        CSetDrawSurface sds(pDI, prcBounds, prcRedraw, pDispSurface);

        _pShape->DrawShape(pDI);
    }
}
Пример #7
0
void Drawing::SetDrawStepUndoable(int s){
//	wxGetApp().DoToolUndoably(new SetDrawingDrawStep(this, s));
	SetDrawingDrawStep sds(this, s);
	sds.Run();
}