|  |     Peter,
    
    I have made a fix program to fix the generated client stub file. It is
    very easy to write. It reads the .cxx stub file, searches for the
    string "CORBA_INV_NO_RESPONSE | OBB_INVOKE_DEFERRED", then looks for
    the corresponding _request->invoke and replaces it by
    _request->send_oneway. The code follows below:
    
    
    /*
     *
     * StubFix - a program to fixup ObjectBroker stub files
     *
     * This program uses the STL.
     *
     *	Description:
     *		This program reads in an stub file and changes the
    _request->invoke (ev) to
     *		_request->send_oneway (ev) if the interface is declared as
    oneway.
     *
     *
     *	Authors: Olerud,	27 Feb 1997
     *
     *	History:
     *		27 Feb	1997	Gunnar Olerud, First version
     *
     */
    
    #ifdef WIN32
    #pragma warning (disable: 4786)	// identifier was truncated to
    '255' characters
    #endif
    #include <string>
    #include <vector>
    #include <map>
    #include <iostream>
    #include <fstream>
    
    #define MAX_LINE_SIZE	512
    
    vector <string, allocator<string> > Lines; // header from the default
    IML file
    
    typedef map <string, string, less<string>, allocator<string> >
    KeywordMap;
    KeywordMap	keywords;
    
    // Forward declarations
    bool ParseFile (string filename, vector <string, allocator<string> >
    *pLines);
    bool creOutputFile(string fileName, vector <string, allocator<string> >
    *pLines);
    bool fixupOneway( vector <string, allocator<string> > *pLines);
    
    // Here it comes! The main program.
    int
    main(int argc, char *argv[])
    {
    	if (argc < 2)
    	{
    		cout << "StubFix: Not enough parameters, syntax:" << endl;
    		cout << "StubFix <stub file>" << endl;
    		return 1;
    	}
    
    	// define the set of special keywords for single-line lines.
    	keywords["Oneway"] = "CORBA_INV_NO_RESPONSE | OBB_INVOKE_DEFERRED";
    
    	// read the IMH files into a vector
    	if (!ParseFile (argv[1], &Lines))
    	{
    		return 1;
    	}
    
    	if (!fixupOneway( &Lines))
    	{
    		cout << "No changes made" << endl;
    		return 0;
    	}
    	// output the default vector to the new IML file
    	creOutputFile(argv[1], &Lines);
    	return 0;
    }
    
    bool 
    ParseFile (string fileName, vector <string, allocator<string> >
    *pLines)
    {
    	char line[MAX_LINE_SIZE];
    
    	ios_base::openmode mode = ios_base::in;
    	ifstream infile (fileName.c_str(), mode);
    	if (!infile.is_open())
    	{
    		cout << "StubFix: Can't open file '" << fileName << "'" <<
    endl;
    		return false;
    	}
    
    	cout << "Reading from file " << fileName << endl;
    
    	while (infile.getline (line, sizeof(line)))
    	{
    		pLines->push_back(line);		
    	} // while (infile.getline (line, sizeof(line)))
    	infile.close ();
    
    	return true;
    }
    
                
    bool
    creOutputFile(string fileName, vector <string, allocator<string> >
    *pLines)
    {
    #ifdef WIN32
    	ofstream fileout (fileName.c_str());
    	if (!fileout.is_open())
    #else
    	ofstream fileout (fileName.c_str());
    	if (!fileout.rdbuf()->is_open())
    #endif
    	{
    		cout << "imhFix: Can't create file '" << fileName << "'" <<
    endl;
    		return false;
    	}
    
    	cout << "Writing to file " << fileName << endl;
    
    
    
    	vector <string, allocator<string> >::iterator lineIT;
    	for (lineIT = pLines->begin(); lineIT != pLines->end(); lineIT++)
    	{
    		fileout << (*lineIT) << endl;
    	}
    
    	fileout.close();
    	return true;
    } // End of creOutputIMHFile()
    
    
    bool
    fixupOneway( vector <string, allocator<string> > *pLines)
    { 
    	int position;
    	bool isChanged = false;
    	vector <string, allocator<string> >::iterator lineIT, replaceIT;
    
    	KeywordMap::iterator it;
    	if ((it = keywords.find ("Oneway")) == keywords.end())
    	{
    		cout << "StubFix: Can't find keyword for Oneway " << endl;
    		return false;
    	}
    
    	string key = (*it).second;
    	cout << "Replacing _request->invoke to _request->send_oneway where
    appropriate" << endl;
    	for (lineIT = pLines->begin(); lineIT != pLines->end(); lineIT++)
    	{
    		//destructor found. Add the virtual keyword if it is not
    there.
    		if ((position = (*lineIT).find(key)) > 0)
    		{
    			for (replaceIT = lineIT + 1; replaceIT !=
    pLines->end(); replaceIT++)
    			{
    				if ((position =
    (*replaceIT).find("_request->invoke")) > 0)
    				{
    					(*replaceIT).replace
    ((*replaceIT).find("invoke"), 6, "send_oneway");
    					isChanged = true;
    					break;
    				}
    			}
    		}
    	}
    	return isChanged;
    
    } // end of fixupLines
    
    
 |