Ice Manual Wrong About Properties Initialization

sheblishebli Member Shebli AnvarOrganization: CEA, IrfuProject: KM3Net underwater telescope
In section 30.9.1, the Ice manual states that one can manage one's own properties (properties not reserved for Ice modules) by initializing the Ice communicator and then using the communicator's getProperties() call. I have tried this little example based on the samples given by the manual:
#include <Ice/Ice.h>
#include <iostream>
int main(int argc, char* argv[])
{
   Ice::CommunicatorPtr ic = Ice::initialize(argc, argv);
   std::cout << "max files = " << 
      ic->getProperties()->getPropertyAsInt("Filesystem.MaxFileSize") 
           << std::endl;
}

Well, this does not work! When I call the program (called 'props') with the following command line:
./props --Filesystem.MaxFileSize=555
it prints out:
max files = 0

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Ice::Initialize will only parse Ice properties.

    Have a look at the section "30.9.3 Parsing Properties":
    You need to use parseCommandLineOptions (and the utility functions) if you want to permit application-specific properties to be set from the command line. For example, to permit the ‑‑Filesystem.MaxFileSize option to be used on the command line, we need to initialize our program as follows:

    And the code example that follows.
  • sheblishebli Member Shebli AnvarOrganization: CEA, IrfuProject: KM3Net underwater telescope
    Thanks for the tip Marc.
    Still, I think that the documentation (section 30.9.1) is misleading in that respect and should be amended accordingly.
    Cheers :)
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    I agree, we will improve this. In essence, 30.9.1 is misleading, because it requires the code from 30.9.3, but it doesn't make any forward reference to this section.
Sign In or Register to comment.