ret_ CXMLLoader::GetDualityOperator(const ch_1 *pszOperator, EDualityCalculate &Calculate) { _START(GET_DUALITY_OPERATOR); #ifdef _DEBUG_ if (!pszOperator) _RET(PARAMETER_NULL | PARAMETER_1); #endif if (0 == strcmp(pszOperator, "add")) Calculate = EC_ADD; else if (0 == strcmp(pszOperator, "sub")) Calculate = EC_SUB; else if (0 == strcmp(pszOperator, "mul")) Calculate = EC_MUL; else if (0 == strcmp(pszOperator, "div")) Calculate = EC_DIV; else if (0 == strcmp(pszOperator, "mod")) Calculate = EC_MOD; else if (0 == strcmp(pszOperator, "and")) Calculate = EC_AND; else if (0 == strcmp(pszOperator, "or")) Calculate = EC_OR; else if (0 == strcmp(pszOperator, "xor")) Calculate = EC_XOR; #ifdef _DEBUG_ else _RET(PARAMETER_TYPE_ERROR | PARAMETER_1); #endif _RET(SUCCESS); }
ret_ CDatagramHandle::Send(const ub_1 *pBuffer, size_ nSize, const ch_1 *pszIP, ub_2 nPort) { _START(HANDLE_SEND); #ifdef _DEBUG_ if (!pBuffer) _RET(PARAMETER_NULL | PARAMETER_1); if (0 == nSize) _RET(PARAMETER_ERROR | PARAMETER_2); if (!pszIP) _RET(PARAMETER_NULL | PARAMETER_3); #endif if (m_bIsInited) { ACE_INET_Addr RemoteAddr(nPort, pszIP); if (-1 != m_Peer.send(pBuffer, nSize, RemoteAddr)) _RET(SUCCESS); } _RET(FAILURE); }
ret_ CXMLLoader::GetFirstName(const ch_1 *pszFullName, ch_1 *sFirstName, size_ &nSize) { _START(GET_FIRST_NAME); #ifdef _DEBUG_ if (!pszFullName) _RET(PARAMETER_NULL | PARAMETER_1); if (!sFirstName) _RET(PARAMETER_NULL | PARAMETER_2); #endif ch_1 * sPos = (ch_1 *)strchr(pszFullName, '.'); size_ nLength = (size_)(sPos - pszFullName); #ifdef _DEBUG_ if (!sPos) _RET(FAILURE); if (length >= size) _RET(FAILURE); #endif strncpy(sFirstName, pszFullName, nLength); sFirstName[nLength] = '\0'; nSize = nLength; _RET(SUCCESS); }
ret_ CConnectorConf::Start(const ch_1 *pszRemoteIP, ub_2 nRemotePort, b_4 nReconnect) { _START(START); #ifdef _DEBUG_ if (!pszRemoteIP) _RET(PARAMETER_NULL | PARAMETER_1); if (0 == pszRemoteIP[0]) _RET(PARAMETER_EMPTY | PARAMETER_1); if (-1 > nReconnect) _RET(PARAMETER_TYPE_ERROR | PARAMETER_3); #endif m_nCurrentReconnect = 0; memset(m_sRemoteIP, 0, IP_MAX_LENGTH); strncpy(m_sRemoteIP, pszRemoteIP, IP_MAX_LENGTH_SIGN); m_nRemotePort = nRemotePort; m_nReconnect = nReconnect; _RET(SUCCESS); }
ret_ CXMLLoader::GetCompareOperator(const ch_1 *pszOperator, ECompareCalculate &Calculate) { _START(GET_COMPARE_OPERATOR); #ifdef _DEBUG_ if (!pszOperator) _RET(PARAMETER_NULL | PARAMETER_1); #endif if (0 == strcmp(pszOperator, "eq")) Calculate = CC_EQ; else if (0 == strcmp(pszOperator, "gl")) Calculate = CC_GL; else if (0 == strcmp(pszOperator, "gt")) Calculate = CC_GT; else if (0 == strcmp(pszOperator, "ge")) Calculate = CC_GE; else if (0 == strcmp(pszOperator, "ls")) Calculate = CC_LS; else if (0 == strcmp(pszOperator, "le")) Calculate = CC_LE; #ifdef _DEBUG_ else _RET(PARAMETER_TYPE_ERROR | PARAMETER_1); #endif _RET(SUCCESS); }
ret_ CXMLLoader::GetLastName(const ch_1 *pszFullName, ch_1 *&sLastName) { _START(GET_LAST_NAME); #ifdef _DEBUG_ if (!pszFullName) _RET(PARAMETER_NULL | PARAMETER_1); if (sLastName) _RET(PARAMETER_NOT_NULL | PARAMETER_2); #endif sLastName = (ch_1 *)strrchr(pszFullName, '.'); #ifdef _DEBUG_ if (!sLastName) _RET(FAILURE); #endif sLastName++; #ifdef _DEBUG_ if ((sLastName - pszFullName) >= (b_4)strlen(pszFullName)) _RET(FAILURE); #endif _RET(SUCCESS); }
void test_image_manager::test1(void) { _START(); _INFO("Verify of internal class nnImageManager: method read configuration and load images"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); miniXmlNode node; #ifdef _UNICODE bool res = miniXmlNode::load(X("..\\..\\conf_utf16.xml"),&node); #else bool res = miniXmlNode::load(X("..\\..\\conf_utf8.xml"),&node); #endif CA_ASSERT(res == true); STRING s; nnImageManager im(s); res = im.readConfiguration(&node); CA_ASSERT(res == true); res = im.loadImages(); CA_ASSERT(res == true); /* const listImage *images = im.getImageList(); if (images != nullptr) { listImage::const_iterator it = images->begin(); listImage::const_iterator _end = images->end(); while (it != _end) { draw((it->second)); it++; } } */ }
ret_ CXMLLoader::GetUnitaryOperator(const ch_1 *pszOperator, EUnitaryCalculate &Calculate) { _START(GET_UNITARY_OPERATOR); #ifdef _DEBUG_ if (!pszOperator) _RET(PARAMETER_NULL | PARAMETER_1); #endif if (0 == strcmp(pszOperator, "eql")) Calculate = UC_EQL; else if (0 == strcmp(pszOperator, "neg")) Calculate = UC_NEG; else if (0 == strcmp(pszOperator, "not")) Calculate = UC_NOT; else if (0 == strcmp(pszOperator, "obv")) Calculate = UC_OBV; #ifdef _DEBUG_ else _RET(PARAMETER_TYPE_ERROR | PARAMETER_1); #endif _RET(SUCCESS); }
ret_ CProcessor::Stop() { _START(STOP); map_handle::iterator pos; for (pos = m_HandleInMap.begin(); pos != m_HandleInMap.end(); pos++) { #ifdef _DEBUG_ if (!pos->second) _RET(ELEMENT_NULL_IN_CONTAINER); #endif _DEL(pos->second); } for (pos = m_HandleOutMap.begin(); pos != m_HandleOutMap.end(); pos++) { #ifdef _DEBUG_ if (!pos->second) _RET(ELEMENT_NULL_IN_CONTAINER); #endif _DEL(pos->second); } m_HandleInMap.clear(); m_HandleOutMap.clear(); for (map_register::iterator pos_ = m_RegisterMap.begin(); pos_ != m_RegisterMap.end(); pos_++) { #ifdef _DEBUG_ if (!pos_->second) _RET(ELEMENT_NULL_IN_CONTAINER); #endif for (set_register::iterator pos_1 = pos_->second->begin(); pos_1 != pos_->second->end(); pos_1++) { ch_1 *sCategory = (ch_1 *)pos_->first.data(); ch_1 *pszKey = (ch_1 *)pos_1->data(); ret_ Ret = CRegister::Instance()->Unregister(sCategory, pszKey); #ifdef _DEBUG_ if (SUCCESS != _ERR(Ret)) _RET_BY(Ret); #endif CTransactionManager::Instance()->Unregister(sCategory, pszKey); } pos_->second->clear(); _DEL(pos_->second); } m_RegisterMap.clear(); _RET(SUCCESS); }
static inline void update_gaps (GESTrack * track) { Gap *gap; GList *gaps; GSequenceIter *it; GESTrackElement *trackelement; GstClockTime start, end, duration = 0, timeline_duration; GESTrackPrivate *priv = track->priv; if (priv->create_element_for_gaps == NULL) { GST_INFO ("Not filling the gaps as no create_element_for_gaps vmethod" " provided"); return; } gaps = priv->gaps; priv->gaps = NULL; /* 1- And recalculate gaps */ for (it = g_sequence_get_begin_iter (priv->trackelements_by_start); g_sequence_iter_is_end (it) == FALSE; it = g_sequence_iter_next (it)) { trackelement = g_sequence_get (it); start = _START (trackelement); end = start + _DURATION (trackelement); if (start > duration) { /* 2- Fill gap */ gap = gap_new (track, duration, start - duration); if (G_LIKELY (gap != NULL)) priv->gaps = g_list_prepend (priv->gaps, gap); } duration = MAX (duration, end); } /* 4- Add a gap at the end of the timeline if needed */ if (priv->timeline) { g_object_get (priv->timeline, "duration", &timeline_duration, NULL); if (duration < timeline_duration) { gap = gap_new (track, duration, timeline_duration - duration); if (G_LIKELY (gap != NULL)) { priv->gaps = g_list_prepend (priv->gaps, gap); } priv->duration = timeline_duration; } } /* 4- Remove old gaps */ g_list_free_full (gaps, (GDestroyNotify) free_gap); }
ret_ CConnectorHandle::OnClose() { _START(ON_CLOSE); if (m_pConnector) m_pConnector->Disconnect(); _RET(SUCCESS); }
I2C_RESULT i2c_Start(void) { #if !defined(I2C_CFGEN_CALLTRACE) _START(); #else printf("i2c_Start\n"); #endif return I2C_RESULT_OK; }
void test_bmpImage_class::test2(void) { _START(); _INFO("verifica interna alla classe: metodo create"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; CA_ASSERT(s.create(100, 100,24, 255) == true); CA_ASSERT((LPBITMAPFILEHEADER)s != nullptr); }
void test_bmpImage_class::test14(void) { _START(); _INFO("verifica interrna alla classe:dimensioni"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.copyFromFile("./old/BORDER.BMP"); s.copyToFile("BORDER.BMP"); }
void test_bmpImage_class::test7(void) { _START(); _INFO("verifica interrna alla classe : metodo isValid()"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); CA_ASSERT(s.isValid()==true); }
I2C_RESULT i2c_Write(unsigned char addr, unsigned char* pData, unsigned char len) { //printf("i2c_write(%d %d %d)\n", (int)addr, (int)*pData, (int)len); #if !defined(I2C_CFGEN_CALLTRACE) I2C_RESULT result; if (config.start) { _START(); } addr <<= 1; /* address is in high 7 bits */ /* low bit 0 is now zero, indicating a write */ //printf("send addr %d\n", (int) addr); result = i2c_TxByte(addr); if (I2C_RESULT_IS_ERROR(result)) { /* probably a NACK */ //printf("nack addr\n"); if (config.stop) { _STOP(); } return result; } while (len != 0) { //printf("send data %d\n", (int)*pData); result = i2c_TxByte(*pData); if (I2C_RESULT_IS_ERROR(result)) { //printf("nak data\n"); if (config.stop) { _STOP(); } return result; } pData++; len--; } if (config.stop) { //printf("STOP\n"); _STOP(); } #else printf("i2c_Write(%d,%d,%d)\n",(int)addr, (int)*pData, (int)len); #endif return I2C_RESULT_OK; }
ret_ CProcessor::Unregister(const ch_1 *pszCategory, const ch_1 *pszKey) { _START(PROCESSOR_UNREGISTER); #ifdef _DEBUG_ if (!pszCategory) _RET(PARAMETER_NULL | PARAMETER_1); if (0 == pszCategory[0]) _RET(PARAMETER_EMPTY | PARAMETER_1); if (!pszKey) _RET(PARAMETER_NULL | PARAMETER_2); if (0 == pszKey[0]) _RET(PARAMETER_EMPTY | PARAMETER_2); #endif CProcessor *pProcessor = null_v; if (SUCCESS == _ERR(CTransactionManager::Instance()->Search(pszCategory, pszKey, pProcessor))) { #ifdef _DEUB_ if (!pProcessor) _RET(ELEMENT_NULL_IN_CONTAINER); #endif map_register::iterator pos = m_RegisterMap.find(pszCategory); if (m_RegisterMap.end() != pos) { set_register::iterator pos_ = pos->second->find(pszKey); if (pos->second->end() != pos_) { pos->second->erase(pszKey); if (0 == pos->second->size()) m_RegisterMap.erase(pszCategory); } } CTransactionManager::Instance()->Unregister(pszCategory, pszKey); } ret_ Ret = CRegister::Instance()->Unregister(pszCategory, pszKey); if (SUCCESS != _ERR(Ret)) _RET_BY(Ret); _RET(SUCCESS); }
void test_bmpImage_class::test13(void) { _START(); _INFO("verifica interrna alla classe:dimensioni"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(50, 100,24, 255); CA_ASSERT(s.check(50, 100)==true); CA_ASSERT(s.check(150, 100)==false); }
/** * ges_timeline_element_set_start: * @self: a #GESTimelineElement * @start: the position in #GstClockTime * * Set the position of the object in its containing layer * * Note that if the timeline snap-distance property of the timeline containing * @self is set, @self will properly snap to its neighboors. */ void ges_timeline_element_set_start (GESTimelineElement * self, GstClockTime start) { GESTimelineElementClass *klass; GESTimelineElement *toplevel_container; g_return_if_fail (GES_IS_TIMELINE_ELEMENT (self)); klass = GES_TIMELINE_ELEMENT_GET_CLASS (self); GST_DEBUG_OBJECT (self, "current start: %" GST_TIME_FORMAT " new start: %" GST_TIME_FORMAT, GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (self)), GST_TIME_ARGS (start)); toplevel_container = ges_timeline_element_get_toplevel_parent (self); if (((gint64) (_START (toplevel_container) + start - _START (self))) < 0) { GST_INFO_OBJECT (self, "Can not move the object as it would imply its" "container to have a negative start value"); gst_object_unref (toplevel_container); return; } gst_object_unref (toplevel_container); if (klass->set_start) { if (klass->set_start (self, start)) { self->start = start; g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_START]); } GST_DEBUG_OBJECT (self, "New start: %" GST_TIME_FORMAT, GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (self))); return; } GST_WARNING_OBJECT (self, "No set_start virtual method implementation" " on class %s. Can not set start %" GST_TIME_FORMAT, G_OBJECT_CLASS_NAME (klass), GST_TIME_ARGS (start)); }
void test_bmpImage_class::test9(void) { _START(); _INFO("verifica interrna alla classe:metodo detach"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; CA_ASSERT(s.detach()==true); CA_ASSERT((LPBITMAPFILEHEADER)(s)==nullptr); delete [](v); }
void test_bmpImage_class::test3(void) { _START(); _INFO("verifica interrna alla classe : verifica struttura bitmapfileheader"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; CA_ASSERT(v->bfType == 0x4d42); CA_ASSERT(v->bfOffBits == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)))); CA_ASSERT(v->bfSize == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (100 * 100 * 3)))); }
ret_ CProcessor::SetHandle(const CNetworkHandle *pHandle) { _START(SET_HANDLE); #ifdef _DEBUG_ if (!pHandle) _RET(PARAMETER_NULL | PARAMETER_1); #endif m_pHandle = (CNetworkHandle *)pHandle; _RET(SUCCESS); }
ret_ CConnectorHandle::OnOpen(const ub_1 *pObj) { _START(ON_OPEN); #ifdef _DEBUG_ if (!pObj) _RET(PARAMETER_NULL | PARAMETER_1); #endif m_pConnector = (CConnector *)pObj; m_pConf = (CConnectorConf *)m_pConnector->GetConf(); _RET(SUCCESS); }
void test_app_manager::test1(void) { _START(); _INFO("Verify of internal class nnAppManager:load and display a draw"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); nnAppManager app; #ifdef _UNICODE STRING name(X("conf_utf16.xml")); #else STRING name(X("conf_utf8.xml")); #endif STRING path("./"); IChild *childs = app.createObjects(name,path); CA_ASSERT(childs != nullptr); bool res; nnPoint p=childs->getView()->getConstPhy(); CA_ASSERT(p.x != 0 ); CA_ASSERT(p.y != 0); res=childs->getImage()->loadImages(); CA_ASSERT(res == true); nnContactNO *v = new nnContactNO(); nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager()); res = mn->addContact(10, 0, v); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)1); nnGenericCoil *u = new nnGenericCoil(); res = mn->addCoil(10, u); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)20); nnContactNC *v1 = new nnContactNC(); res = mn->addContact(12, 0, v1); CA_ASSERT(res == true); nnPoint p1(12, 0); nnPoint p2(10, 0); nnConnection::connectComponent(childs->getManager(), p1, p2); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bmpImage &bdraw = childs->getView()->getDraw(); for(unsigned int i=0;i<bdraw.getWidth();i+=100) bdraw.line(i,0,i,bdraw.getHeight(),255,0,0,0xfefefefe); for(unsigned int u=0;u<bdraw.getHeight();u+=100) bdraw.line(0,u,bdraw.getWidth(),u,0,0,255,0xfefefefe); bdraw.line(0,0,bdraw.getWidth(),bdraw.getHeight(),0,255,0,0xfefefefe); bdraw.line(0,0,200,bdraw.getHeight(),0,255,255,0xfefefefe); bdraw.frameRect(10,10,300,300,128,128,64,0xfefefefe); bdraw.frameRect(50,50,250,250,128,128,64,0xfefefefe); draw(&bdraw); MKDIR(".\\bmp",S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); bdraw.copyToFile(X(".\\bmp\\test1_app.bmp")); }
void test_bmpImage_class::test12(void) { _START(); _INFO("verifica interrna alla classe:metodo landscape"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(50, 100,24, 255); CA_ASSERT((int)s.getWidth()==50); CA_ASSERT((int)s.getHeight() == 100); s.landscape(false); CA_ASSERT((int)s.getWidth()== 100); CA_ASSERT((int)s.getHeight()== 50); }
void test_bmpImage_class::test1(void) { _START(); _INFO("verifica interrna alla classe: metodo attach"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; CA_ASSERT_M("Pointer to bitmapfileheader test is null", (nullptr == (LPBITMAPFILEHEADER)s)); LPBITMAPFILEHEADER p; p= (LPBITMAPFILEHEADER) new unsigned char[sizeof(BITMAPFILEHEADER)]; CA_ASSERT_M("Test Attach method", s.attach(p) == true); CA_ASSERT_M("Pointer to bitmapfileheader is valid", (nullptr != (LPBITMAPFILEHEADER)s)); }
ret_ CProcessor::SetMsgHandle(const CProgram &Program, EDirection Direction, const CPDUInfo *pPDUInfo) { _START(SET_MSG_HANDLE); #ifdef _DEBUG_ if (DIRECTION_IN != Direction && DIRECTION_OUT != Direction && DIRECTION_ALL != Direction) { _RET(PARAMETER_TYPE_ERROR | PARAMETER_2); } if (!pPDUInfo) _RET(PARAMETER_NULL | PARAMETER_3); #endif if (DIRECTION_IN == (EDirection)(Direction & DIRECTION_IN)) { #ifdef _DEBUG_ map_handle::const_iterator pos = m_HandleInMap.find(pPDUInfo); if (pos != m_HandleInMap.end()) _RET(ELEMENT_EXIST_IN_CONTAINER); #endif CProgram *pHandle = new CProgram(Program); m_HandleInMap.insert(map_handle::value_type(pPDUInfo, pHandle)); } if (DIRECTION_OUT == (EDirection)(Direction & DIRECTION_OUT)) { #ifdef _DEBUG_ map_handle::const_iterator pos = m_HandleOutMap.find(pPDUInfo); if (pos != m_HandleOutMap.end()) _RET(ELEMENT_EXIST_IN_CONTAINER); #endif CProgram *pHandle = new CProgram(Program); m_HandleOutMap.insert(map_handle::value_type(pPDUInfo, pHandle)); } _RET(SUCCESS); }
void test_app_manager::test2(void) { _START(); _INFO("Verify of internal class nnAppManager:load and display a draw, and scroll it"); _AUTHOR("Coppi Angelo n2draw library "); _STOP(); nnAppManager app; #ifdef _UNICODE STRING name(X("conf_utf16.xml")); #else STRING name(X("conf_ut8.xml")); #endif STRING path("./"); IChild *childs = app.createObjects(name,path); CA_ASSERT(childs != nullptr); bool res; res = childs->getImage()->loadImages(); CA_ASSERT(res == true); nnContactNO *v = new nnContactNO(); nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager()); res = mn->addContact(10, 0, v); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)1); nnGenericCoil *u = new nnGenericCoil(); res = mn->addCoil(10, u); CA_ASSERT(res == true); CA_ASSERT((int)mn->size() == (int)20); nnContactNC *v1 = new nnContactNC(); res = mn->addContact(12, 0, v1); CA_ASSERT(res == true); nnPoint p1(12, 0); nnPoint p2(10, 0); nnConnection::connectComponent(childs->getManager(), p2, p1); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bmpImage &bdraw = childs->getView()->getDraw(); draw(&bdraw); childs->getView()->handlerScrollHorz(2); res = childs->getView()->updateDraw(); //CA_ASSERT(res == true); bdraw = childs->getView()->getDraw(); draw(&bdraw); childs->getView()->handlerScrollVert(2); res = childs->getView()->updateDraw(); CA_ASSERT(res == true); bdraw = childs->getView()->getDraw(); draw(&bdraw); }
void test_bmpImage_class::test6(void) { _START(); _INFO("verifica interrna alla classe: metodo copyfrom bmpImage"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); bmpImage v; v.copyFrombmpImage(s); int res = memcmp((LPBITMAPFILEHEADER)s, (LPBITMAPFILEHEADER)v, ((LPBITMAPFILEHEADER)(s))->bfSize); CA_ASSERT(res== 0); draw(&v); }
void test_bmpImage_class::test10(void) { _START(); _INFO("verifica interrna alla classe: create attach clear"); _AUTHOR("Coppi Angelo bmpImage library "); _STOP(); bmpImage s; s.create(100, 100,24, 255); bmpImage t; t.create(100, 100,24, 255); LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s; t.clear(); t.attach(s); CA_ASSERT(v == (LPBITMAPFILEHEADER)t); }