コード例 #1
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintMessage(int importance, 
		  const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4)
{
  if (importance <= printmessage_importance)
    {
      Ng_PrintDest(MyStr(" ")+s1+s2+s3+s4+MyStr("\n"));
    }
}
コード例 #2
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintMessageCR(int importance, 
		    const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
		    const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  if (importance <= printmessage_importance)
    {
      Ng_PrintDest(MyStr(" ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\r"));
    }
}
コード例 #3
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main()
{
    std::vector <MyStr> testVec = {
        MyStr(4, "key 4"), 
        MyStr(3, "key 3"), 
        MyStr(3, "key 3"), 
        MyStr(2, "key 2"), 
        MyStr(2, "key 2"), 
        MyStr(2, "key 2")
    };

    // sort the vevctor
    std::sort(testVec.begin(), testVec.end());
    
    // search for all elements with key=2
    auto range = std::equal_range(testVec.begin(), testVec.end(), 2, comp());
    
    for(auto it = range.first; it != range.second; ++it) {
        std::cout << "key: " << it->key << " value: " << it->strval << '\n';
    }
}
コード例 #4
0
/**************************************************************************/
/* File:   msghandler.hh                                                  */
/* Author: Johannes Gerstmayr                                             */
/* Date:   20. Nov. 99                                                    */
/**************************************************************************/


extern void PrintDot(char ch = '.');


//Message Pipeline:

//importance: importance of message: 1=very important, 3=middle, 5=low, 7=unimportant
extern void PrintMessage(int importance, 
			 const MyStr& s1, const MyStr& s2=MyStr());
extern void PrintMessage(int importance, 
			 const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4=MyStr());
extern void PrintMessage(int importance, 
			 const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
			 const MyStr& s5, const MyStr& s6=MyStr(), const MyStr& s7=MyStr(), const MyStr& s8=MyStr());

// CR without line-feed
extern void PrintMessageCR(int importance, 
			   const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", 
			   const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintFnStart(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", 
			 const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintWarning(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", 
			 const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
extern void PrintError(const MyStr& s1, const MyStr& s2="", const MyStr& s3="", const MyStr& s4="", 
コード例 #5
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintSysError(const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
		const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  if (printerrors)
    Ng_PrintDest(MyStr(" SYSTEM ERROR: ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\n"));
}
コード例 #6
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintUserError(const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
		const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  Ng_PrintDest(MyStr(" USER ERROR: ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\n"));
}
コード例 #7
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintWarning(const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
		  const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  if (printwarnings)
    Ng_PrintDest(MyStr(" WARNING: ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\n"));
}
コード例 #8
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintFnStart(const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
		  const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  if (printfnstart)
    Ng_PrintDest(MyStr(" Start Function: ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\n"));
}
コード例 #9
0
ファイル: msghandler.cpp プロジェクト: 11235813/netgen-csg2d
void PrintTime(const MyStr& s1, const MyStr& s2, const MyStr& s3, const MyStr& s4, 
	       const MyStr& s5, const MyStr& s6, const MyStr& s7, const MyStr& s8)
{
  if (printmessage_importance >= 3)
    Ng_PrintDest(MyStr(" Time = ")+s1+s2+s3+s4+s5+s6+s7+s8+MyStr("\n"));
}
コード例 #10
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main()
{    
    std::vector <MyStr> testVec = {
        MyStr(4, "value 4"),
        MyStr(4, "value 04"),
        MyStr(4, "value 004"),
        MyStr(3, "value 3"),
        MyStr(3, "value 03"),
        MyStr(9, "value 9"),
        MyStr(9, "value 09"), 
        MyStr(9, "value 009"), 
        MyStr(9, "value 0009"), 
        MyStr(7, "value 7"), 
        MyStr(7, "value 07"), 
        MyStr(1, "value 1")
    };
    
    // custom copyier
    std::multimap<int, MyStr> tempMap;
        
    PairMaker pairMaker;
    my_copy(testVec.cbegin(), testVec.cend(), std::inserter(tempMap, tempMap.end()), pairMaker);
    std::cout << "specialized copy->" <<std::endl;
    std::for_each(tempMap.cbegin(), tempMap.cend(), 
        [](const std::multimap<int, MyStr>::value_type& rValue){
            std::cout 
            << "key[" << rValue.first 
            << "] value:" << rValue.second.strval 
            << std::endl;
        });
    
    std::multimap<int,MyStr> mmap = {
        std::make_pair(4, MyStr(4, "value 4")),
        std::make_pair(4, MyStr(4, "value 04")),
        std::make_pair(4, MyStr(4, "value 004")),
        std::make_pair(3, MyStr(3, "value 3")),
        std::make_pair(3, MyStr(3, "value 03")),
        std::make_pair(9, MyStr(9, "value 9")), 
        std::make_pair(9, MyStr(9, "value 09")), 
        std::make_pair(9, MyStr(9, "value 009")), 
        std::make_pair(9, MyStr(9, "value 0009")), 
        std::make_pair(7, MyStr(7, "value 7")), 
        std::make_pair(7, MyStr(7, "value 07")), 
        std::make_pair(1, MyStr(1, "value 1"))
    };
    
    //auto ostriter = std::ostream_iterator<std::pair<int,std::string>>(std::cout, ",");
    for (auto iter = mmap.cbegin(); iter != mmap.cend(); ) {
        /* ... process *itr ... */
        auto range = mmap.equal_range(iter->first);
        std::cout << "processing [" 
            << std::distance (range.first, range.second) 
            << "] entries with key[" << range.first->first 
            << "]" << std::endl;
        //std::copy (range.first, range.second, ostriter);
//        std::for_each(range.first, range.second, 
//            [](const std::multimap<int, MyStr>::value_type& rValue){
//                std::cout 
//                << "key[" << rValue.first 
//                << "] value:" << rValue.second.strval 
//                << std::endl;
//            });
        // advance to the next range
        iter = range.second;
    }    
    return 0;
}