void FreezeScript::AssignVisitor::visitSequence(const SequenceDataPtr& dest) { Slice::TypePtr type = dest->getType(); SequenceDataPtr src = SequenceDataPtr::dynamicCast(_src); if(src && isCompatible(type, src->getType())) { DataList& srcElements = src->getElements(); DataList destElements; Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); assert(seqType); Slice::TypePtr elemType = seqType->type(); string typeName = typeToString(type); for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) { DataPtr element = _factory->create(elemType, false); Destroyer<DataPtr> elementDestroyer(element); AssignVisitor v(*p, _factory, _errorReporter, _convert, typeName + " element"); element->visit(v); destElements.push_back(element); elementDestroyer.release(); } DataList& l = dest->getElements(); l.swap(destElements); } else { typeMismatchError(type, _src->getType()); } }
void ParallelInfo::sendSumwz(const DataList &toSend) { int P_Tag = 0; // P_Info points to the info struct for the neigbor under consideration ParallelInfo *P_Info; #if defined(TIMING_MODE) long long start, elapsed; start = rdtsc(); #endif P_Info = &P_Nodes[0]; // send sumwz to the root node for (unsigned int i = 0; i < toSend.size(); i++) P_Info->P_sumwz[i] = toSend.at(i); #if defined(RNG_BUCKET) P_RandComm->Send(&P_Info->P_sumwz[0], totalNumNrns, MPI_DOUBLE, P_ROOT_NODE_NUM, P_Tag, MPI_COMM_WORLD); #else MPI_Send(&P_Info->P_sumwz[0], totalNumNrns, MPI_DOUBLE, P_ROOT_NODE_NUM, P_Tag, MPI_COMM_WORLD); #endif #if defined(TIMING_MODE) elapsed = rdtsc() - start; Output::Out() << MSG << "Elapsed nonroot_snd time = " << elapsed * 1.0 / TICKS_PER_SEC << " seconds" << endl; #endif }
DataList ParallelInfo::rcvNrnWij(const UIVector &nrnNodeConn, const int nrn, const UIVector &Shuffle, const UIVector &FanInCon, const DendriticSynapse * const * const inMatrix) { int P_Tag = 0; MPI_Status P_Status; // the wmatrix data!!! (receive one row of wmatrix) DataList toReturn; #if !defined(PARENT_CHLD) //Root node needs to account for its own data const unsigned int shuffRow = Shuffle.at(nrn); const DendriticSynapse * const dendriticTree = inMatrix[shuffRow]; for (unsigned int c = 0; c < FanInCon[shuffRow]; ++c) toReturn.push_back( dendriticTree[c].getWeight() ); #endif //Now get data from all other nodes for (unsigned int nodeNum = 1; nodeNum < P_NumNodes; nodeNum++) { int NumConPerNode = nrnNodeConn.at(nodeNum); float *tmp_win = new float[NumConPerNode]; MPI_Recv(&tmp_win[0], NumConPerNode, MPI_FLOAT, nodeNum, P_Tag, MPI_COMM_WORLD, &P_Status); for (int i = 0; i < NumConPerNode; i++) toReturn.push_back(tmp_win[i]); delete[] tmp_win; } return toReturn; }
void ScrDB::Expect(TARGETING::TargetHandle_t i_ptargetHandle, BitString & bs, uint64_t registerId) { PRDF_TRAC( "ScrDB::Expect() huid: %X, addr: %016X, data: %08X %08X", getHuid(i_ptargetHandle), registerId, bs.getFieldJustify(0,32), bs.getFieldJustify(32,32) ); SimScrDataSet eValues; DataList data; // parse all data given data.push_back(bs.getFieldJustify(0,32)); data.push_back(bs.getFieldJustify(32,32)); eValues.AddData(data); // PRDF_TRAC("get a copy"); PreScrMap scrMap = eChipset[i_ptargetHandle]; // create/get copy of map // PRDF_TRAC("update register value"); scrMap[registerId] = eValues; // Add entree // PRDF_TRAC("update the master"); eChipset[i_ptargetHandle] = scrMap; // copy it back //PRDF_EXIT( "ScrDB::Expect()" ); }
static void read_u30_list(DataList<uint32_t>& list, uint32_t val_count, const uint8_t*& pos) { list.ensureCapacity(val_count); while (val_count--) { list.add(AvmCore::readU32(pos)); } }
DataList ParseFile(QString const& fileName) { DataList dataList; QFileInfo info(fileName); if (info.exists()) { try { // First, check for a QChem input/output file. For input files // OB returns an empty molecule, for output files the charge and // multiplicity don't seem to be parsed correctly. if (fileName.endsWith(".in", Qt::CaseInsensitive) || fileName.endsWith(".inp", Qt::CaseInsensitive) || fileName.endsWith(".qcin", Qt::CaseInsensitive) || fileName.endsWith(".qcinp", Qt::CaseInsensitive) || fileName.endsWith(".out", Qt::CaseInsensitive) || fileName.endsWith(".qcout", Qt::CaseInsensitive) ) { QChem qchemParser; dataList += qchemParser.parseFile(fileName); } // Second, check for external charges, which are not recognized by Open // Babel. Check the ExternalChargesParser.h file for a description of // the external charges format. if (dataList.isEmpty()) { ExternalCharges chargeParser; dataList += chargeParser.parseFile(fileName); } // Now let Open Babel have a crack. OpenBabel obParser; dataList += obParser.parseFile(fileName); // OB will pull the geometry from a FChk file, but not the MO // information so we must pass this information explicitly. if (fileName.endsWith(".fchk", Qt::CaseInsensitive)) { FormattedCheckpoint fchkParser; dataList += fchkParser.parseFile(fileName); } // Finally, if we have found anything we append the file as well. if (!dataList.isEmpty()) { Layer::Files* files(new Layer::Files()); files->appendLayer(new Layer::File(fileName)); dataList.append(files); } } catch (IOError& ioerr) { if (Base::s_displayErrors) QMsgBox::warning(0, "IQmol", ioerr.what()); } catch (std::exception& e) { if (Base::s_displayErrors) QMsgBox::warning(0, "IQmol", e.what()); } } return dataList; }
bool Node::IsChildOf(DataList* what) const { DataList* current = Parent(); while (current) { if (current == what) return true; current = current->Parent(); } return false; }
void Auth2Certificate::AppendDataList( const DataList &theDataList ) { Auth2Certificate::DataListCIter anIter = theDataList.begin(); while( anIter != theDataList.end() ) { CertificateDataBlock *aBlock = (*anIter)->Duplicate(); mDataList.push_back( aBlock ); ++anIter; } }
static DataList convolve(const DataList &f1, const DataList &f2, const float dt = 1.0f) { const unsigned int f1size = f1.size(); const unsigned int f2size = f2.size(); DataList toReturn = DataList(f1size + f2size - 1, 0); for (unsigned int i = 0; i < f1size; ++i) { for (unsigned int j = 0; j < f2size; ++j) { toReturn[i+j] += f1[i] * f2[j] * dt; } } return toReturn; }
void FreezeScript::TransformVisitor::visitSequence(const SequenceDataPtr& dest) { Slice::TypePtr type = dest->getType(); if(_info->doDefaultTransform(type)) { SequenceDataPtr s = SequenceDataPtr::dynamicCast(_src); if(s && isCompatible(type, _src->getType())) { DataList& srcElements = s->getElements(); DataList destElements; Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type); assert(seqType); Slice::TypePtr elemType = seqType->type(); string typeName = typeToString(type); for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p) { DataPtr element = _info->getDataFactory()->create(elemType, false); Destroyer<DataPtr> elementDestroyer(element); try { TransformVisitor v(*p, _info, typeName + " element"); element->visit(v); destElements.push_back(element); elementDestroyer.release(); } catch(const ClassNotFoundException& ex) { // // If transformation of the sequence element fails because a class // could not be found, then we invoke purgeObjects() to determine // whether we should ignore the situation (and remove the element // from the sequence) or raise the exception again. // if(!_info->purgeObjects()) { throw; } warning("purging element of sequence " + typeToString(type) + " due to missing class type " + ex.id); } } DataList& l = dest->getElements(); l.swap(destElements); } else { typeMismatchError(type, _src->getType()); } } _info->executeCustomTransform(dest, _src); }
void OutputMemoryLeakInfo(const char* dir) { #ifdef _CHECK_MEMORY_LEAK AllocHeader* header = NULL; if (NULL != dir && strlen(dir) > 0) { KLog::SetLogDirectory(dir); } // output momory of leak while (NULL != (header = g_allocList.GetHeadAndRemove())) { OutputDebugStringf("leak file:%s, line:%d, size:%d" , header->file, header->nLineNo, header->size); } // output momory of bound while (NULL != (header = g_boundList.GetHeadAndRemove())) { OutputDebugStringf("bound file:%s, line:%d, size:%d" , header->file, header->nLineNo, header->size); } // output lost momory void* data = NULL; while (NULL != (data = g_lostList.GetHeadAndRemove())) { OutputDebugStringf("lost data:%p", data); } #endif }
void MyDelete(void *p, const char *szFile = __FILE__, unsigned int nLineNo = __LINE__) { // print log OutputDebugStringf("MyDelete( file : %s, line : %d, data : %p )", szFile, nLineNo, p); // OutputDebugStringf("delete data:%p", p); // __android_log_print(ANDROID_LOG_DEBUG, "leak", "delete data:%p", p); // we need to free our allocator too if (g_allocList.Has(p)) { // get header AllocHeader* pHeader = g_allocList.GetAndRemove(p); // get end AllocEnd* pEnd = (AllocEnd*)((char*)p + pHeader->size); // check out of bounds if (!pHeader->IsCheckCodeOK() || !pEnd->IsCheckCodeOK()) { // out of bounds g_boundList.Insert(pHeader); } else { // free momory free(pHeader); //operator delete(pHeader); } } else { // lost point g_lostList.Insert(p); } }
//============================================================================= // METHOD: SPELLipcDataChunk:: //============================================================================= SPELLipcDataChunk::DataList SPELLipcDataChunk::getChunk( const std::string& id, unsigned int num ) { DataList chunk; DataMap::iterator it = m_chunks.find(id); if (it != m_chunks.end()) { ListOfDataList* chunks = it->second; if (num<chunks->size()) { DataList* list = (*chunks)[num]; DataList::iterator lit; for( lit = list->begin(); lit != list->end(); lit++) { chunk.push_back( (*lit) ); } } } return chunk; }
void fillDataLists(const vector<FrameEnhanced> &frames, DataList& redChannels, DataList& greenChannels, DataList& blueChannels) { assert(frames.size() == redChannels.size()); assert(frames.size() == greenChannels.size()); assert(frames.size() == blueChannels.size()); // build temporary data structure for ( size_t exp = 0; exp < frames.size(); ++exp ) { Channel* red; Channel* green; Channel* blue; frames[exp].frame()->getXYZChannels(red, green, blue); redChannels[exp] = red->data(); greenChannels[exp] = green->data(); blueChannels[exp] = blue->data(); } }
void ScrDB::Read(TARGETING::TargetHandle_t i_ptargetHandle, BitString & bs, uint64_t registerId) { //PRDF_DENTER( "ScrDB::Read() huid: 0x%X, addr: 0x%016X", // getHuid(i_ptargetHandle), registerId ); DataList data; unsigned int dataWordSize = bs.getBitLen()/32; dataWordSize += (bs.getBitLen() % 32) ? 1 : 0; // if the register has a predetermined value than get it if(pChipset.find(i_ptargetHandle) != pChipset.end()) { PreScrMap pscrmap = pChipset[i_ptargetHandle]; if(pscrmap.find(registerId) != pscrmap.end()) // we must have a predetermined value { SimScrDataSet pValues = pscrmap[registerId]; data = pValues.GetData(); // get next set of values // pValues has changed - copy it back pscrmap[registerId] = pValues; pChipset[i_ptargetHandle] = pscrmap; } } if(data.size() == 0) // use the last value written to this reg { // get a copy of the scrMap for this chip - if one does not exist it will be created ScrMap scrMap = chipset[i_ptargetHandle]; // get a copy of the data for this address from the scrMap for this chip // if data structure does not exist, it will be created, but will be empty data = scrMap[registerId]; if(data.size() == 0) // This is the first time this register has been accessed { while(data.size() < dataWordSize) data.push_back(0); // zero fill scrMap[registerId] = data; chipset[i_ptargetHandle] = scrMap; // update the persistent copy of the scrMap } } if(0 != data.size()) { for(unsigned int i = 0; i < data.size(); ++i) { bs.setFieldJustify((i*32), 32, data[i]); } PRDF_TRAC( "ScrDB::Read() huid: %X, addr: %016X, data: %08X %08X", getHuid(i_ptargetHandle), registerId, data[0], 2 == data.size() ? data[1] : 0 ); } //PRDF_DEXIT( "ScrDB::Read()" ); }
//============================================================================= // METHOD: SPELLipcDataChunk:: //============================================================================= int SPELLipcDataChunk::startChunks( const std::string& id, const DataList& data ) { SPELLmonitor m(m_lock); if (data.size()<=m_chunkSize) return 0; ListOfDataList* chunks = new ListOfDataList(); DataList::const_iterator it; DataList::const_iterator end = data.end(); unsigned int lineCount = 0; DataList* chunk = new DataList(); for( it = data.begin(); it != end; it++) { chunk->push_back( (*it) ); lineCount++; if (lineCount==m_chunkSize) { chunks->push_back( chunk ); chunk = new DataList(); lineCount = 0; } } // Add the last partial chunk if any if (chunk->size()>0) { chunks->push_back( chunk ); } m_chunks[id] = chunks; int totalChunks = chunks->size(); return totalChunks; }
Combo::Combo(Layer::Molecule* molecule, DataList const& frames, int const interpolationFrames, double const speed) : Base(1.0, speed, Ramp), m_molecule(molecule), m_frames(frames), m_bounce(false), m_loop(false), m_interpolationFrames(interpolationFrames), m_currentIndex(-1) { m_referenceFrames = 1 + (frames.size()-1)/(m_interpolationFrames+1); int nCycles(m_bounce ? 2*m_referenceFrames-1 : m_referenceFrames-1); setCycles(nCycles); DataList::iterator iter; for (iter = m_frames.begin(); iter != m_frames.end(); ++iter) { (*iter)->m_surface->setCheckState(Qt::Unchecked); } setCurrentIndex(0); }
/******************************************************************************* * Function : * Description : * Arguments : * Returns : * Remarks : ********************************************************************************/ void AdaBoost::predict ( DataList & datalist, double tao ) { cout << "prediction..." << X << endl; int tp = 0, fp = 0, fn = 0, tn = 0; for ( auto&& obj : datalist.get() ) { Mat image = obj.get_image(); int label = (obj.get_label() == learning_label) ? 1 : 0; double c1 = 0; for ( int x = 0; x < X; x++ ) { alpha[x].perform_transforms(image); alpha[x].compute_output(); c1 += rho[x]*alpha[x].get_output(); } auto c = ( c1 > tao ) ? 1 : 0; cout << obj.get_name() << endl; cout << label << " " << c << " : " << c1 << endl << endl; if ( c == 1 && label == 1 ) { tp++; // True positive = correctly identified } else if ( c == 1 && label == 0 ) { fp++; // False positive = incorrectly identified } else if ( c == 0 && label == 1 ) { fn++; // False negative = incorrectly rejected } else if ( c == 0 && label == 0 ) { tn++; // True negative = correctly rejected } } cout << "tp: " << tp << ", "; cout << "fp: " << fp << ", "; cout << "fn: " << fn << ", "; cout << "tn: " << tn << ", "; double accuracy = (tp+tn)*1. / (tp+tn+fp+fn)*1.; cout << "accuracy: " << accuracy*100. << endl; }
void makeNode(DataList& in) { for(int i = 0; i< in.size(); i++) { Node* temp = new Node(i+1); stringstream left1,down1,top1,right1; int left2,down2,top2,right2; if(in[i][0][0] == '-') { string temp0 = in[i][0]; temp0.erase(temp0.begin()); left1<<temp0; left1>>left2; left2 = (-1)*left2; } else {
void DBDictionary::GetColData( int colNum, const DataList & dataList, std::vector<std::string> & outList ) { if( colNum < 0 ) { printf( "read error" ); return; } int size = dataList.size(); for( int num = 0; num < size; num++ ) { std::string data = dataList[num]._data[colNum]; if( IsSameData( data, outList ) == false ) { printf( "%s \n", data.c_str() ); outList.push_back( data ); } } }
DataList* CreateEventTestData() { DataList* dataList = new DataList(); NamedEventDataList* systemEventData = CreateSystemEventData(); NamedEventDataList* runEventData = CreateRunEventData(); NamedEventDataList* productionEventData = CreateProductionEventData(); NamedEventDataList* agentEventData = CreateAgentEventData(); NamedEventDataList* printEventData = CreatePrintEventData(); NamedEventDataList* xmlEventData = CreateXMLEventData(); NamedEventDataList* updateEventData = CreateUpdateEventData(); NamedEventDataList* stringEventData = CreateStringEventData(); dataList->push_back(systemEventData); dataList->push_back(runEventData); dataList->push_back(productionEventData); dataList->push_back(agentEventData); dataList->push_back(printEventData); dataList->push_back(xmlEventData); dataList->push_back(updateEventData); dataList->push_back(stringEventData); return dataList; }
//Sort data void sortDataList(DataList& a) { sort(a.begin(),a.end(),myfunction); }
void getData() { // fstream fs ("..//input/iccad2015_input.case2" ,fstream::in); fstream fs ("..//input/test.txt" ,fstream::in); // fstream fs ("test.txt" ,fstream::in); string line; while(getline(fs,line)) { int a = line[0]; string num; num.clear(); Data d; d.clear(); if((a>=48 && a<=57) || a == 45) { for(int i=0; i< line.size(); i++) { if(((int)line[i]>=48 && (int)line[i]<=57 && i < line.size()-1) || (int)line[i]==45 ) { num.push_back(line[i]); }else if((int)line[i] == 44 ) { d.push_back(num); num.clear(); }else if(i == line.size()-1) { num.push_back(line[i]); d.push_back(num); num.clear(); list.push_back(d); d.clear(); } } } else if(a==65) { for(int i=0;i<line.size();i++) { if(line[i]>=48 && line[i]<=57) { alpha.push_back(line[i]); } } } else if(a==66) { for(int i=0;i<line.size();i++) { if(line[i]>=48 && line[i]<=57) { beta.push_back(line[i]); } } } else if(a==79) { for(int i=0;i<line.size();i++) { if(line[i]>=48 && line[i]<=57) { omega.push_back(line[i]); } } } } }
string to_string(const DataList &list) { return Convert::to_string<'[', ']'>(list.begin(), list.end(), [](const ObjectPtr &obj) { return to_string(obj); }); }
//ctor SpecificColorWindow :: SpecificColorWindow( BRect paramBound, uint32 paramkind) : ScrollingWindow( paramBound, myPrefs->lvwTitleStr[paramkind], lScrollViewName[paramkind], lNamePrefFrame[paramkind], myPrefs->mpPreferenceSet, true, false), mui32Kind(paramkind), mpViewColorControl(NULL), mpHighColorControl(NULL), mpLowColorControl(NULL), mpBarColorControl(NULL), mpFillColorControl(NULL), mpViewColorWell(NULL), mpHighColorWell(NULL), mpLowColorWell(NULL), mpBarColorWell(NULL), mpFillColorWell(NULL), mpBarHeightGadget(NULL), mpColorWellWidthGadget(NULL), mpColorWellHeightGadget(NULL), mpThumbRadioView(NULL), mpCCLrv(NULL), mpSliderBarCB(NULL), mpSliderBarFillCB(NULL), mpDemoItem(NULL) { sem_id calc_sem; if ((calc_sem = create_sem(1, "calc_sem")) < B_NO_ERROR) { warning(myPrefs->FailCreateSemaphore); return; } acquire_sem(calc_sem); try { LayoutMatrix * pholdTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ///////////////////////////////////////////////////////////////////////////////////////////// BFont * pBFont = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFont->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFont->SetSize(fontSize); pBFont->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pMyStringDrawer = new MyStringDrawer( "specificTitleMyStringDrawer", myPrefs->lvwTitleStr[mui32Kind], pholdTitleLayoutMatrix, pBFont); ///////////////////////////// if (!myPrefs->mbUseColorControl && !myPrefs->mbUseColorWell) { warning(myPrefs->noCCenabled); } LayoutMatrix * pholdViewCCLayoutMatrix = NULL; LayoutMatrix * pholdHighCCLayoutMatrix = NULL; LayoutMatrix * pholdLowCCLayoutMatrix = NULL; MyStringDrawer * pMyStringDrawerAXX = NULL; MyStringDrawer * pMyStringDrawerBXX = NULL; MyStringDrawer * pMyStringDrawerCXX = NULL; rgb_color color;//re-use for every setvalue if (myPrefs->mbUseColorControl) { pholdViewCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns ///////////////////////////////////////////////////////////////////////////////////// pMyStringDrawerAXX = new MyStringDrawer( "MyStringDrawerAXX", myPrefs->ColorWindowHeading2, pholdViewCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpViewColorControl = new MyColorControl( myPrefs->mCCL, "ColorControlAXX", COLORCONTROL_VIEW, pholdViewCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerViewColor(&color); mpViewColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindView); throw; break; } ///////////////////// pholdHighCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns //////////////////////////////// pMyStringDrawerBXX = new MyStringDrawer( "MyStringDrawerBXX", myPrefs->ColorWindowHeading3, pholdHighCCLayoutMatrix); ///////////////////////////////////////////// mpHighColorControl = new MyColorControl( myPrefs->mCCL, "HighColorControlBXX", COLORCONTROL_HIGH, pholdHighCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerHighColor(&color); mpHighColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindHigh); throw; break; } ////////////////////////////////////////////////////////////// pholdLowCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////// pMyStringDrawerCXX = new MyStringDrawer( "MyStringDrawerCXX", myPrefs->ColorWindowHeading4, pholdLowCCLayoutMatrix); /////////////////////////////////////////////////////////////////// mpLowColorControl = new MyColorControl( myPrefs->mCCL, "LowColorControlCXX", COLORCONTROL_LOW, pholdLowCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerLowColor(&color); mpLowColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindLow); throw; break; } } //////////////////////// LayoutMatrix * pholdColorWellLayoutMatrix = NULL; if (myPrefs->mbUseColorWell) { pholdColorWellLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 3, this);//rows,columns ////////////// mpViewColorWell = new ColorWell( "ColorWellViewColorPref", VIEW_COLOR, myPrefs->ColorWindowHeading5, this, pholdColorWellLayoutMatrix); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// mpHighColorWell = new ColorWell( "ColorWellHighColorPref", HIGH_COLOR, myPrefs->ColorWindowHeading6, this, pholdColorWellLayoutMatrix); //////////////////////////////////////////////////////////////////////////////////////////////////// mpLowColorWell = new ColorWell( "ColorWellLowColorPref", LOW_COLOR, myPrefs->ColorWindowHeading7, this, pholdColorWellLayoutMatrix); } /////////////////////////////////////////////////////////////////////// LayoutMatrix * pholdDemoLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ////////////////////////////////// int32 kindDemo; void * pholdDemo; switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: { MyButton * pholdDemoMyButton = new MyButton( "demoButton", myPrefs->DemoButtonLabel, DEMOBUTTONMSG, pholdDemoLayoutMatrix); kindDemo = KIND_MYBUTTON; pholdDemo = (void *)pholdDemoMyButton; } break; case SPECIFIC_COLOR_PICTURE: { BPicture * pOnPicture; BPicture * pOnDisabledPicture; BPicture * pOffPicture; BPicture * pOffDisabledPicture; BWindow * bWindow = new BWindow( BRect(0, 0, 32, 32), //manditory for BPicture NULL, B_DOCUMENT_WINDOW, 0); BView * bView = new BView( BRect(0, 0, 32, 32), NULL, B_FOLLOW_NONE, 0); // BWindow bWindow( BRect(0, 0, 32, 32), //manditory for BPicture // NULL, // B_DOCUMENT_WINDOW, // 0); // BView bView( BRect(0, 0, 32, 32), // NULL, // B_FOLLOW_NONE, // 0); bWindow->AddChild(bView); bView->BeginPicture(new BPicture); bView->MoveTo(5, 5); bView->StrokeRect(BRect(0,0,8,8)); pOffPicture = bView->EndPicture(); bView->BeginPicture(new BPicture); bView->MoveTo(10, 5); bView->StrokeRect(BRect(0,0,10,15)); pOnPicture = bView->EndPicture(); bView->BeginPicture(new BPicture); bView->MoveTo(2, 5); bView->FillRect(BRect(0,0,22,20)); pOffDisabledPicture = bView->EndPicture(); bView->BeginPicture(new BPicture); bView->MoveTo(1, 5); bView->FillRect(BRect(0,0,6,15)); pOnDisabledPicture = bView->EndPicture(); //bView.RemoveSelf(); bWindow->Run(); bWindow->PostMessage(B_QUIT_REQUESTED); MyPictureButton * pholdDemoMyPictureButton = new MyPictureButton( BRect(0, 0, 32, 32), "DemoPictureButton", pOffPicture, pOnPicture, pOffDisabledPicture, pOnDisabledPicture, DEMOPICTUREBUTTONMSG, B_TWO_STATE_BUTTON,//B_ONE_STATE_BUTTON pholdDemoLayoutMatrix); kindDemo = KIND_MYPICTUREBUTTON; pholdDemo = (void *)pholdDemoMyPictureButton; } break; case SPECIFIC_COLOR_RADIOVIEW: { BList * pBList = new BList(); RadioViewData * pRadioViewDataOne = new RadioViewData( '_one', myPrefs->DemoRadio1Label, pBList); RadioViewData * pRadioViewDataTwo = new RadioViewData( '_two', myPrefs->DemoRadio2Label, pBList); RadioViewData * pRadioViewDataThree = new RadioViewData( 'thre', myPrefs->DemoRadio3Label, pBList); MyRadioView * pholdMyRadioView = new MyRadioView( "demoRadio", false,//true gives vertical orientation pBList, myPrefs->GetPreferredFont(), pholdDemoLayoutMatrix); if (!pholdMyRadioView->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } kindDemo = KIND_MYRADIOVIEW; pholdDemo = (void *)pholdMyRadioView; } break; case SPECIFIC_COLOR_CHECKBOX: { MyCheckBox * pholdCheckBox = new MyCheckBox( "checkBox", myPrefs->DemoCheckBoxLabel, B_CONTROL_ON, '_one', pholdDemoLayoutMatrix); kindDemo = KIND_MYCHECKBOX; pholdDemo = (void *)pholdCheckBox; } break; case SPECIFIC_COLOR_STATUSBAR: { MyStatusBar * pholdStatusBar = new MyStatusBar( "StatusBar", myPrefs->DemoStatusBarLeadLabel, myPrefs->DemoStatusBarTrailLabel, 50, 10.0, pholdDemoLayoutMatrix); kindDemo = KIND_MYSTATUSBAR; pholdDemo = (void *)pholdStatusBar; } break; case SPECIFIC_COLOR_SLIDER: { MySlider * pholdSlider = new MySlider( BRect(1, 1, 65, 32), "Slider", "Label", 'Sldr', 1, 10, .5, pholdDemoLayoutMatrix); kindDemo = KIND_MYSLIDER; pholdDemo = (void *)pholdSlider; } break; case SPECIFIC_COLOR_COLORCONTROL: { MyColorControl * pholdColorControl = new MyColorControl( myPrefs->mCCL, "ColorControl", DEMOCOLORCONTROLMSG, pholdDemoLayoutMatrix); kindDemo = KIND_MYCOLORCONTROL; pholdDemo = (void *)pholdColorControl; } break; case SPECIFIC_COLOR_TEXTVIEW: { float leftOffset; float baseline; float width; float height; if (!StringBoundsBox( myPrefs->TextGadgetLabel, &width, &height, &leftOffset, &baseline)) { throw; } MyTextView * pholdTextView = new MyTextView( "textView", NULL, width, 6 * height,//allow 6 lines visible pholdDemoLayoutMatrix); rgb_color textColor; myPrefs->GetPreferredMyTextViewHighColor(&textColor); pholdTextView->SetFontAndColor(myPrefs->GetPreferredFont(), B_FONT_ALL, &textColor); pholdTextView->SetText(myPrefs->TextGadgetLabel); kindDemo = KIND_MYTEXTVIEW; pholdDemo = (void *)pholdTextView; } break; case SPECIFIC_COLOR_LISTVIEW: { DataList * dataList = new DataList(); DataNode * nodeOne = new DataNode(myPrefs->ListViewSample1); dataList->AddItem(nodeOne); DataNode * nodeTwo = new DataNode(myPrefs->ListViewSample2); dataList->AddItem(nodeTwo); DataNode * nodeThree = new DataNode(myPrefs->ListViewSample3); dataList->AddItem(nodeThree); MyListView * mlv = new MyListView( "mlvTitle", dataList, 'selc', 'invc', B_SINGLE_SELECTION_LIST, pholdDemoLayoutMatrix); kindDemo = KIND_MYLISTVIEW; pholdDemo = (void *)mlv; } break; case SPECIFIC_COLOR_INT8GADGET: { Int8Gadget * pholdInt8Gadget = new Int8Gadget( MIN_I8, "int8Gadget", myPrefs->GetInt8GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT8GADGET; pholdDemo = (void *)pholdInt8Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt8Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT8GADGET: { UInt8Gadget * pholdUInt8Gadget = new UInt8Gadget( MAX_UI8, "uInt8Gadget", myPrefs->GetUInt8GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT8GADGET; pholdDemo = (void *)pholdUInt8Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt8Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT16GADGET: { Int16Gadget * pholdInt16Gadget = new Int16Gadget( MIN_I16, "int16Gadget", myPrefs->GetInt16GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT16GADGET; pholdDemo = (void *)pholdInt16Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt16Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT16GADGET: { UInt16Gadget * pholdUInt16Gadget = new UInt16Gadget( MAX_UI16, "uInt16Gadget", myPrefs->GetUInt16GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT16GADGET; pholdDemo = (void *)pholdUInt16Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt16Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT32GADGET: { Int32Gadget * pholdInt32Gadget = new Int32Gadget( MIN_I32, "int32Gadget", myPrefs->GetInt32GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT32GADGET; pholdDemo = (void *)pholdInt32Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt32Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT32GADGET: { UInt32Gadget * pholdUInt32Gadget = new UInt32Gadget( MAX_UI32, "uInt32Gadget", myPrefs->GetUInt32GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT32GADGET; pholdDemo = (void *)pholdUInt32Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt32Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT64GADGET: { Int64Gadget * pholdInt64Gadget = new Int64Gadget( MIN_I64, "int64Gadget", myPrefs->GetInt64GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT64GADGET; pholdDemo = (void *)pholdInt64Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt64Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT64GADGET: { UInt64Gadget * pholdUInt64Gadget = new UInt64Gadget( MAX_UI64, "uInt64Gadget", myPrefs->GetUInt64GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT64GADGET; pholdDemo = (void *)pholdUInt64Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt64Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_FLOATGADGET: { FloatGadget * pholdFloatGadget = new FloatGadget( (float)12.34, "floatGadget", myPrefs->GetFloatGadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_FLOATGADGET; pholdDemo = (void *)pholdFloatGadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterFloatNumeric); pholdFloatGadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_STRINGGADGET: { StringGadget * pholdStringGadget = new StringGadget( myPrefs->GetStringGadgetLabel, "stringGadget", myPrefs->GetStringGadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGGADGET; pholdDemo = (void *)pholdStringGadget; } break; case SPECIFIC_COLOR_UINT32CONTROL: { UInt32Control * pholdUInt32Control = new UInt32Control( 123, "uInt32Control", myPrefs->UInt32ControlLabel, DEMOINTCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_UINT32CONTROL; pholdDemo = (void *)pholdUInt32Control; } break; case SPECIFIC_COLOR_FLOATCONTROL: { FloatControl * pholdFloatControl = new FloatControl( (float)1.23, "floatControl", myPrefs->FloatControlLabel, DEMOFLOATCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_FLOATCONTROL; pholdDemo = (void *)pholdFloatControl; } break; case SPECIFIC_COLOR_STRINGCONTROL: { StringControl * pholdStringControl = new StringControl( "stringControlName", myPrefs->StringControlLabel, NULL, DEMOSTRINGCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGCONTROL; pholdDemo = (void *)pholdStringControl; } break; case SPECIFIC_COLOR_COLORWELL: { ColorWell * pholdColorWell = new ColorWell( "colorWell", NO_COLOR, myPrefs->DemoRoLabel, this, pholdDemoLayoutMatrix); kindDemo = KIND_COLORWELL; pholdDemo = (void *)pholdColorWell; } break; case SPECIFIC_COLOR_STRINGDRAWER: { MyStringDrawer * pholdMyStringDrawer = new MyStringDrawer( "stringDrawer", myPrefs->DemoTextItemText, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGDRAWER; pholdDemo = (void *)pholdMyStringDrawer; } break; default: warning(myPrefs->BadSpecItemKind); throw; break; } mpDemoItem = pholdDemo; ///////////////////// LayoutMatrix * pholdBarTitleLayoutMatrix = NULL; LayoutMatrix * pholdBarCCLayoutMatrix = NULL; LayoutMatrix * pholdBarCWLayoutMatrix = NULL; LayoutMatrix * pholdBarHLayoutMatrix = NULL; LayoutMatrix * pholdColorWellWHLayoutMatrix = NULL; LayoutMatrix * pholdSliderLayoutMatrix = NULL; LayoutMatrix * pholdFillCCLayoutMatrix = NULL; LayoutMatrix * pholdFillCWLayoutMatrix = NULL; LayoutMatrix * pholdCCLLayoutMatrix = NULL; /////////////////////////// if (mui32Kind == SPECIFIC_COLOR_STATUSBAR) { pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns //////////////////////////////////////////////////////////////// BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFontBar->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFontBar->SetSize(fontSize); pBFontBar->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer( "specificTitleBarMyStringDrawer", myPrefs->BarColorTitle, pholdBarTitleLayoutMatrix, pBFontBar); ////////////////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer( "BarMyStringDrawerAXX", myPrefs->BarCCLabel, pholdBarCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpBarColorControl = new MyColorControl( myPrefs->mCCL, "barColorControl", BARCOLORCONTROL, pholdBarCCLayoutMatrix); myPrefs->GetPreferredMyBarStatusColor(&color); mpBarColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpBarColorWell = new ColorWell( "ColorWellViewColorPref", BAR_COLOR, myPrefs->BarCWLabel, this, pholdBarCWLayoutMatrix); } /////////////////////////////////////////// pholdBarHLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ////////////////////////////////////////////////////////////////////////// mpBarHeightGadget = new FloatGadget( myPrefs->GetPreferredBarHeight(), "BarHeightFloatGadget", myPrefs->EnterBarHeightLabel, 0, this, pholdBarHLayoutMatrix); BMessageFilter * bmfBHDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterFloatNumeric); mpBarHeightGadget->AddFilter(bmfBHDemo); } ///////////////////////////////////////////////////////////////// else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL) { pholdCCLLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns ////////////////////////////////////////////////////////////////////////// BFont * pCCLFont = new BFont(myPrefs->GetPreferredFont()); float fontSize = pCCLFont->Size(); fontSize *= 1.5; if (fontSize > 200) { fontSize = 200; } pCCLFont->SetSize(fontSize); MyStringDrawer * pCCLMyStringDrawer = new MyStringDrawer( "CCLMyStringDrawer", myPrefs->ColorControlKind, pholdCCLLayoutMatrix, pCCLFont); BList * bl = new BList(); RadioViewData * pRVD4x64 = new RadioViewData( CCL4x64RV, myPrefs->CC_4x64_Cell, bl, (B_CELLS_4x64 == myPrefs->mCCL)); RadioViewData * pRVD8x32 = new RadioViewData( CCL8x32RV, myPrefs->CC_8x32_Cell, bl, (B_CELLS_8x32 == myPrefs->mCCL)); RadioViewData * pRVD16x16 = new RadioViewData( CCL16x16RV, myPrefs->CC_16x16_Cell, bl, (B_CELLS_16x16 == myPrefs->mCCL)); RadioViewData * pRVD32x8 = new RadioViewData( CCL32x8RV, myPrefs->CC_32x8_Cell, bl, (B_CELLS_32x8 == myPrefs->mCCL)); RadioViewData * pRVD64x4 = new RadioViewData( CCL64x4RV, myPrefs->CC_64x4_Cell, bl, (B_CELLS_64x4 == myPrefs->mCCL)); mpCCLrv = new MyRadioView( "CCLRadioView", false, bl, myPrefs->GetPreferredFont(), pholdCCLLayoutMatrix); if (!mpCCLrv->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } ////////////////////////////////////////////////////////////////////////// } else if (mui32Kind == SPECIFIC_COLOR_SLIDER) { pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns //////////////////////////////////////////////////////////////// BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFontBar->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFontBar->SetSize(fontSize); pBFontBar->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer( "specificTitleBarMyStringDrawer", myPrefs->BarColorTitle, pholdBarTitleLayoutMatrix, pBFontBar); ////////////////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer( "BarMyStringDrawerAXX", myPrefs->BarCCLabel, pholdBarCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpBarColorControl = new MyColorControl( myPrefs->mCCL, "barColorControl", BARCOLORCONTROL, pholdBarCCLayoutMatrix); myPrefs->GetPreferredMyBarStatusColor(&color); mpBarColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpBarColorWell = new ColorWell( "ColorWellViewColorPref", BAR_COLOR, myPrefs->BarCWLabel, this, pholdBarCWLayoutMatrix); } //////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdFillCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pFillMSD = new MyStringDrawer( "FillMSD", myPrefs->FillCCLabel, pholdFillCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpFillColorControl = new MyColorControl( myPrefs->mCCL, "fillColorControl", FILLCOLORCONTROL, pholdFillCCLayoutMatrix); myPrefs->GetPreferredMyBarFillSliderColor(&color); mpFillColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdFillCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpFillColorWell = new ColorWell( "ColorWellViewColorPref", FILL_COLOR, myPrefs->FillCWLabel, this, pholdFillCWLayoutMatrix); } /////////////////////////////////////////// pholdSliderLayoutMatrix = new LayoutMatrix(BESTSIZE, 3, 1, this);//rows,columns ////////////////////////////////////// mpSliderBarCB = new MyCheckBox( "SliderBarCheckBox", myPrefs->ColorSliderBarCBLabel, myPrefs->mui32ColorSliderBar, SLIDERBARCB, pholdSliderLayoutMatrix); mpSliderBarFillCB = new MyCheckBox( "SliderBarCheckBoxFill", myPrefs->FillSliderBarCBLabel, myPrefs->mui32FillSliderBar, SLIDERBARFILLCB, pholdSliderLayoutMatrix); BList * bl = new BList(); RadioViewData * pRVDOne = new RadioViewData( THUMB_RECT, myPrefs->DemoRadioLabelThumbRect, bl, (B_BLOCK_THUMB == myPrefs->GetPreferredThumbStyle())); RadioViewData * pRVDTwo = new RadioViewData( THUMB_TRI, myPrefs->DemoRadioLabelThumbTri, bl, (B_TRIANGLE_THUMB == myPrefs->GetPreferredThumbStyle())); mpThumbRadioView = new MyRadioView( "thumbRadioView", true, bl, myPrefs->GetPreferredFont(), pholdSliderLayoutMatrix); if (!mpThumbRadioView->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } } ///////////////////////////////////////////////////////////////////////////////////// else if (mui32Kind == SPECIFIC_COLOR_COLORWELL) { pholdColorWellWHLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns //////////////////////////////////////////////////////////////// mpColorWellWidthGadget = new UInt8Gadget( myPrefs->GetPreferredColorWellWidth(), "ColorWellWidthGadget", myPrefs->EnterColorWellWidthLabel, 0, this, pholdColorWellWHLayoutMatrix); BMessageFilter * bmfW = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); mpColorWellWidthGadget->AddFilter(bmfW); ////////////////////////////////////////////////////////////// mpColorWellHeightGadget = new UInt8Gadget( myPrefs->GetPreferredColorWellHeight(), "ColorWellHeightGadget", myPrefs->EnterColorWellHeightLabel, 0, this, pholdColorWellWHLayoutMatrix); BMessageFilter * bmfH = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); mpColorWellHeightGadget->AddFilter(bmfH); //////////////////// } ///////////////////////////////////////////////////////////// release_sem(calc_sem); pholdTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, MATRIXVERTICALOFFSET, calc_sem); float bottom = pholdTitleLayoutMatrix->mfBottom; float right = MATRIXHORIZONTALOFFSET; if (myPrefs->mbUseColorControl) { pholdViewCCLayoutMatrix->Calc(right, bottom, calc_sem); pholdHighCCLayoutMatrix->Calc(pholdViewCCLayoutMatrix->mfRight, bottom, calc_sem); pholdLowCCLayoutMatrix->Calc(pholdHighCCLayoutMatrix->mfRight, bottom, calc_sem); bottom = pholdLowCCLayoutMatrix->mfBottom; if (bottom < pholdHighCCLayoutMatrix->mfBottom) { bottom = pholdHighCCLayoutMatrix->mfBottom; } if (bottom < pholdViewCCLayoutMatrix->mfBottom) { bottom = pholdViewCCLayoutMatrix->mfBottom; } right = pholdLowCCLayoutMatrix->mfRight; } float cwRight = MATRIXHORIZONTALOFFSET; if (myPrefs->mbUseColorWell) { pholdColorWellLayoutMatrix->Calc(cwRight, bottom, calc_sem); bottom = pholdColorWellLayoutMatrix->mfBottom; cwRight = pholdColorWellLayoutMatrix->mfRight; } if (cwRight > right) { right = cwRight; } pholdDemoLayoutMatrix->Calc(right, pholdTitleLayoutMatrix->mfBottom, calc_sem); if ( (mui32Kind == SPECIFIC_COLOR_STATUSBAR) || (mui32Kind == SPECIFIC_COLOR_SLIDER)) { pholdBarTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); bottom = pholdBarCCLayoutMatrix->mfBottom; } if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); bottom = pholdBarCWLayoutMatrix->mfBottom; } float ccRightSB = cwRight; float cwRightSB = cwRight; if (myPrefs->mbUseColorControl) { ccRightSB = pholdBarCCLayoutMatrix->mfRight; } if (myPrefs->mbUseColorWell) { cwRightSB = pholdBarCWLayoutMatrix->mfRight; } if (ccRightSB > cwRightSB) { cwRightSB = ccRightSB; } if (mui32Kind == SPECIFIC_COLOR_STATUSBAR) { pholdBarHLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); } else //if (mui32Kind == SPECIFIC_COLOR_SLIDER) { if (myPrefs->mbUseColorControl) { pholdFillCCLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); bottom = pholdFillCCLayoutMatrix->mfBottom; } else { bottom = pholdBarTitleLayoutMatrix->mfBottom; } if (myPrefs->mbUseColorWell) { pholdFillCWLayoutMatrix->Calc(cwRightSB, bottom, calc_sem); } float fccRightSB = cwRightSB; float fcwRightSB = cwRightSB; if (myPrefs->mbUseColorControl) { fccRightSB = pholdFillCCLayoutMatrix->mfRight; } if (myPrefs->mbUseColorWell) { fcwRightSB = pholdFillCWLayoutMatrix->mfRight; } if (fccRightSB > fcwRightSB) { fcwRightSB = fccRightSB; } pholdSliderLayoutMatrix->Calc(fcwRightSB + 3, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); } } else if (mui32Kind == SPECIFIC_COLOR_COLORWELL) { pholdColorWellWHLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); } else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL) { pholdCCLLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom + 3, calc_sem); } } catch (...) { warning(myPrefs->CaughtSpecificColorWindowCTOR); release_sem(calc_sem); throw; } try { BMenuItem * menuItem; BMenu * APPMenu = new BMenu(myPrefs->AppMenuLabel); menuItem = new BMenuItem( myPrefs->AboutMenuLabel, new BMessage(ABOUT_SPECIFICCOLORWINDOW)); APPMenu->AddItem(menuItem); menuItem = new BMenuItem( myPrefs->CloseWindow, new BMessage(B_QUIT_REQUESTED)); APPMenu->AddItem(menuItem); menuItem = new BMenuItem( myPrefs->QuitMenuLabel, new BMessage(QUIT_APP)); APPMenu->AddItem(menuItem); mpMenuBar->AddItem(APPMenu); } catch(...) { throw; } }//end
void ScrDB::Write(TARGETING::TargetHandle_t i_ptargetHandle, BitString & bs, uint64_t registerId) { PRDF_TRAC( "ScrDB::Write() huid: %X, addr: %016X, data: %08X %08X", getHuid(i_ptargetHandle), registerId, bs.getFieldJustify(0,32), bs.getFieldJustify(32,32) ); unsigned int dataWordSize = bs.getBitLen()/32; // PRDF_TRAC("dataWordSize1: %d", dataWordSize); dataWordSize += (bs.getBitLen() % 32) ? 1 : 0; // PRDF_TRAC("dataWordSize2: %d", dataWordSize); DataList data; // parse all data given data.push_back(bs.getFieldJustify(0,32)); data.push_back(bs.getFieldJustify(32,32)); // PRDF_TRAC("parse all data given"); // look for expected data DataList expectedData; if(eChipset.find(i_ptargetHandle) != eChipset.end()) { PRDF_TRAC("found target"); PreScrMap escrmap = eChipset[i_ptargetHandle]; if(escrmap.find(registerId) != escrmap.end()) // we have expected data value { PRDF_TRAC("found scom reg"); SimScrDataSet eValues = escrmap[registerId]; expectedData = eValues.GetData(); // get next set of values escrmap[registerId] = eValues; eChipset[i_ptargetHandle] = escrmap; } } if(expectedData.size() > 0) { if((expectedData[0] != data[0]) || (expectedData[1] != data[1])) { PRDF_ERR("Verify SC register: %p", i_ptargetHandle); PRDF_ERR(" Address: 0x%016X", registerId); PRDF_ERR("SCR write Actual : %08X %08X", data[0], data[1]); PRDF_ERR("SCR write Expected: %08X %08X", expectedData[0], expectedData[1]); } else { PRDF_TRAC("Verify SC register: %p", i_ptargetHandle); PRDF_TRAC(" Address: 0x%016X", registerId); PRDF_TRAC("SCR write Actual: %08X %08X", data[0], data[1]); } } // PRDF_TRAC("get a copy"); // get a copy of the scrMap for this chip - if one does not exist it will be created ScrMap scrMap = chipset[i_ptargetHandle]; // PRDF_TRAC("update register value"); // update register value scrMap[registerId] = data; // copy the supplied value to the register // PRDF_TRAC("update the master"); chipset[i_ptargetHandle] = scrMap; // scrMap is only a copy so must update the master //PRDF_EXIT( "ScrDB::Write()" ); }
int main(int argc, char* argv[]) { int capacity; int NumOfFood; fstream fin(argv[1]); fstream fout; fout.open(argv[2],ios::out); fin>>capacity; fin>>NumOfFood; int x; int y; int weight; DataList FoodInfo; vector<int>aa(4,0); FoodInfo.push_back(aa); while(fin>>x>>y>>weight) { Data temp(3); temp[0] = x; temp[1] = y; temp[2] = weight; FoodInfo.push_back(temp); } //test cout<<capacity<<endl; cout<<NumOfFood<<endl; //cout<<x<<" "<<y<<" "<<weight<<endl; for(int i=0;i<FoodInfo.size();i++) { for(int j=0;j<3;j++) { cout<<FoodInfo[i][j]<<" "; } cout<<endl; } //cout<<"capacity="<<capacity<<endl; //cout<<"size:"<<FoodInfo.size()<<endl; int *minimalDist = new int[FoodInfo.size()]; //int* position = new int[FoodInfo.size()]; vector<int> position; ShortestPath(FoodInfo.size()-1,capacity,FoodInfo,minimalDist,position); for(int i=1;i<=NumOfFood;i++) { cout<<minimalDist[i]<<endl; } cout<<"postition"<<endl; for(int i=position.size()-1;i>=0;i--) { cout<<position[i]<<endl; } //cout<<FoodInfo.size()-1<<endl; cout<<"GREEDY!"<<endl; int distance = 0; Data position1; Greedy(FoodInfo,FoodInfo.size()-1,capacity,position1,distance); for(int i=0;i<position1.size();i++) { cout<<position1[i]<<endl; } cout<<"distance"<<distance<<endl; cout<<"end"<<endl; /* cout<<CapacityCheck(0 , 3 , capacity ,FoodInfo); cout<<CapacityCheck(1 , 3 , capacity ,FoodInfo); cout<<CapacityCheck(2 , 3 , capacity ,FoodInfo); cout<<CapacityCheck(3 , 3 , capacity ,FoodInfo); cout<<endl; cout<<dist2origin(0, FoodInfo)<<endl; cout<<dist2origin(1, FoodInfo)<<endl; cout<<dist2origin(2, FoodInfo)<<endl; cout<<dist2origin(3, FoodInfo)<<endl; cout<<endl; //cout<<dist(0, 0, FoodInfo)<<endl; //c//out<<dist(0, 1, FoodInfo)<<endl; //cout<<dist(1, 2, FoodInfo)<<endl; //cout<<"asd"<<dist(0, 1, FoodInfo)+dist(1, 2, FoodInfo)+dist(2, 3, FoodInfo)<<endl; */ //cout<<dist2origin(1, FoodInfo); }
Client::DataList Client::getData(const string& query) { QJsonDocument root; QString temp = QString::fromStdString(query); QByteArray bytearray = query.c_str(); QString query_string = QString::fromUtf8(bytearray.data(), bytearray.size()); qDebug() << "query_string: " << query_string; QString uri = getQueryString(query_string); qDebug() << "uri: " << uri; get(uri, root); DataList result; QVariantMap variant = root.toVariant().toMap(); // Iterate through the weather data for (const QVariant &i : variant["businesses"].toList()) { QVariantMap item = i.toMap(); QString name = removeTestInfo(item["name"].toString()); qDebug() << "name: " << name; QString business_url = item["business_url"].toString(); qDebug() << "business_url: " << business_url; QString s_photo_url = item["s_photo_url"].toString(); qDebug() << "s_photo_url: " << s_photo_url; QString photo_url = item["photo_url"].toString(); qDebug() << "photo_url: " << photo_url; QString rating_s_img_url = item["rating_s_img_url"].toString(); qDebug() << "rating_s_img_url: " << rating_s_img_url; QString address = item["address"].toString(); qDebug() << "address: " << address; QString telephone = item["telephone"].toString(); qDebug() << "telephone: " << telephone; QVariantList deals = item["deals"].toList(); QString summary; if ( deals.count() > 0 ) { QVariantMap temp = deals.first().toMap(); summary = temp["description"].toString(); } qDebug() << "summary: " << summary; // Add a result to the weather list result.emplace_back( Data { name.toStdString(), business_url.toStdString(), s_photo_url.toStdString(), photo_url.toStdString(), rating_s_img_url.toStdString(), address.toStdString(), telephone.toStdString(), summary.toStdString() }); } return result; }
bool Network::ProcPacket() { if( _client == NULL ) { return FALSE; } Sleep(30); Packet* p; p = _client->Receive(); if (p==0) return FALSE; RakNet::BitStream inStream( p->data, p->length, false ); unsigned char packetIdentifier; inStream.Read( packetIdentifier ); switch (packetIdentifier) { case S2CH_LOGIN_RES: { // 패킷 읽기 int isSuccessAuth; inStream.Read( isSuccessAuth ); int isHost; inStream.Read( isHost ); int userNo; inStream.Read( userNo ); // 데이터 저장 Network::GetInstance()._isSuccessAuth = isSuccessAuth; Network::GetInstance()._isHost = isHost; _myUserNo = userNo; } break; case S2H_GET_USERINFO_LIST_RES: { // 기존 데이터 초기화 _userList.clear(); // 패킷 읽기 int count = 0; inStream.Read( count ); for( int num = 0; num < count; num++ ) { UserInfo userInfo; inStream.Read( userInfo._userNo ); inStream.Read( userInfo._userName ); inStream.Read( userInfo._age ); inStream.Read( userInfo._sex ); inStream.Read( userInfo._tall ); inStream.Read( userInfo._weight ); inStream.Read( userInfo._blood ); inStream.Read( userInfo._tel ); inStream.Read( userInfo._pic ); _userList.push_back( userInfo ); } // 데이터 갱신 return TRUE; } break; case S2CH_GET_USERDATA_LIST_RES: { // 기존 데이터 초기화 _userDataList.clear(); // 패킷 읽기 int count = 0; inStream.Read( count ); for( int num = 0; num < count; num++ ) { UserData userData; inStream.Read( userData._year ); inStream.Read( userData._month ); inStream.Read( userData._day ); inStream.Read( userData._hour ); inStream.Read( userData._min ); inStream.Read( userData._value ); inStream.Read( userData._temp ); _userDataList.push_back( userData ); } // 데이터 갱신 return TRUE; } break; case S2H_CLIENT_DATA_RES: { // 패킷 읽기 int userNo = 0; inStream.Read( userNo ); int count = 0; inStream.Read( count ); DataList dataList; for( int num = 0; num < count; num++ ) { PacketData data; inStream.Read( data ); dataList.push_back( data ); } // 기존 데이터 초기화 DataList & buf = _dataMap[ userNo ]; buf.clear(); // 데이터 갱신 _dataMap[ userNo ] = dataList; } break; default: { } break; } _client->DeallocatePacket(p); }
//====================================================================================================================== // // create player // bool MessageLib::sendCreatePlayer(PlayerObject* playerObject,PlayerObject* targetObject) { if(!_checkPlayer(targetObject)) return(false); sendCreateObjectByCRC(playerObject,targetObject,false); if(targetObject == playerObject) { sendBaselinesCREO_1(playerObject); sendBaselinesCREO_4(playerObject); } sendBaselinesCREO_3(playerObject,targetObject); sendBaselinesCREO_6(playerObject,targetObject); sendCreateObjectByCRC(playerObject,targetObject,true); sendContainmentMessage(playerObject->getPlayerObjId(),playerObject->getId(),4,targetObject); sendBaselinesPLAY_3(playerObject,targetObject); sendBaselinesPLAY_6(playerObject,targetObject); if(targetObject == playerObject) { sendBaselinesPLAY_8(playerObject,targetObject); sendBaselinesPLAY_9(playerObject,targetObject); } //close the yalp sendEndBaselines(playerObject->getPlayerObjId(),targetObject); sendPostureMessage(playerObject,targetObject); if(playerObject->getParentId()) { sendContainmentMessage(playerObject->getId(),playerObject->getParentId(),4,targetObject); } if(targetObject == playerObject) { // tangible objects if(TangibleObject* hair = dynamic_cast<TangibleObject*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Hair))) { //only create the hair as the helmet will be created at a different time if(hair->getTangibleType() == TanType_Hair) { sendCreateTangible(hair,targetObject); } } // create inventory and contents if(dynamic_cast<TangibleObject*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))) { sendInventory(playerObject); } // mission bag if(TangibleObject* missionBag = dynamic_cast<TangibleObject*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Mission))) { gMessageLib->sendCreateTangible(missionBag,playerObject); //Now iterate through the missions and create them clientside MissionBag* mbag = dynamic_cast<MissionBag*> (missionBag); MissionList::iterator it = mbag->getMissions()->begin(); while(it != mbag->getMissions()->end()) { MissionObject* mission = dynamic_cast<MissionObject*>(*it); sendCreateObjectByCRC(mission, targetObject, false); sendContainmentMessage(mission->getId(), mbag->getId(), 4, targetObject); sendBaselinesMISO_3(mission, targetObject); sendBaselinesMISO_6(mission, targetObject); sendBaselinesMISO_8(mission, targetObject); sendBaselinesMISO_9(mission, targetObject); sendEndBaselines(mission->getId(), targetObject); ++it; } } // datapad Datapad* datapad = playerObject->getDataPad(); if(datapad) { //would be nice to use the tangibles objectcontainer for the datapad //need to get missionobjects intangibles, Man Schematics, waypoints and stuff in though, so better do it manually gMessageLib->sendCreateTangible(datapad,playerObject); //now iterate through the schematics and create them clientside Datapad* dpad = dynamic_cast<Datapad*> (datapad); ManufacturingSchematicList* manufacturingSchematics = dpad->getManufacturingSchematics(); ManufacturingSchematicList::iterator it = manufacturingSchematics->begin(); while(it != manufacturingSchematics->end()) { gMessageLib->sendCreateManufacturingSchematic((dynamic_cast<ManufacturingSchematic*>(*it)),playerObject ,false); ++it; } //Send player's intangibles vehicles,pets,droids...etc DataList* intangibles = dpad->getData(); DataList::iterator ite = intangibles->begin(); while(ite != intangibles->end()) { if(IntangibleObject* itno = dynamic_cast<IntangibleObject*>(*ite)) { gMessageLib->sendCreateInTangible(itno, dpad->getId(), playerObject); //dont add it to the MainObjectMap //gWorldManager->addObject(itno,true); switch(itno->getItnoGroup()) { case ItnoGroup_Vehicle: { // set Owner for vehicles if(VehicleController* vehicle = dynamic_cast<VehicleController*>(itno)) { vehicle->set_owner(playerObject); } } break; default: break; } } ++ite; } //Should send accepted missions here } } //equipped items are already in the creo6 so only send them for ourselves sendEndBaselines(playerObject->getId(),targetObject); sendUpdatePvpStatus(playerObject,targetObject); if(targetObject == playerObject) { // We are actually sending this info from CharacterLoginHandler::handleDispatchMessage at the opCmdSceneReady event. // sendFriendListPlay9(playerObject); // sendIgnoreListPlay9(playerObject); //request the GRUP baselines from chatserver if grouped if(playerObject->getGroupId() != 0) { gMessageLib->sendIsmGroupBaselineRequest(playerObject); } } //Player mounts if(playerObject->checkIfMountCalled()) { if(playerObject->getMount()) { gMessageLib->sendCreateObject(playerObject->getMount(),targetObject); if(playerObject->checkIfMounted()) { gMessageLib->sendContainmentMessage(playerObject->getId(), playerObject->getMount()->getId(), 0xffffffff, targetObject); } } } return(true); }