Home Help Center

Unable to define string sequence

gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
I'm sure this is something obvious that I'm not seeing, but I don't seem to be able to define a string sequence in my .ice file. Any help would be much appreciated.

I tried defining my sequence and got a "syntax error" on it, then I tried to use the builtin definition and got an "undefined" on that, even though I included the BuiltInSequences.ice file. Here is my current .ice file with one string sequence (includePatterns) that generates the syntax error and one (excludePatterns) that generates the undefined error:

============================================================
#ifndef STEELESWBU
#define STEELESWBU

#include <C:/Program Files/Ice-3.3.0/slice/Ice/BuiltinSequences.ice>

module SteeleSW
{
module BU
{
enum BUstatus
{
Succeeded,
Failed,
DirectoryNotFound,
InvalidIncludePattern,
InvalidExcludePattern,
ZipNotPossible,
EncryptNotPossible,
TargetObjInvalid,
HashObjInvalid
};

struct Backup
{
string sourceDir; //Root dir for backup
sequence<string> includePatterns; //Regex's for files that ARE backed up
StringSeq excludePatterns; //Regex's for files that are NOT backed up
bool zipForXmit; //TRUE if data is zipped for transmission
bool encryptSession; //TRUE if session is encrypted
string targetObjID; //Object that receives backup blocks
string hashObjID; //Object that sends block hashes
};

interface IBUSource
{
BUstatus execute();
BUstatus cancel();

};
class BUSource implements IBUSource
{
Backup BU;
};

};
};

#endif
===========================================================


Here is the execution of slice2jave:
===========================================================
C:\Documents and Settings\Greg>slice2java --output-dir "C:\Documents and Settings\Greg\My Documents\EclipseWorkspace\BU\src" -I"C:\Program Files\Ice-3.3.0\slice\Ice" --meta java:java5 "C:\Documents and Settings\Greg\My Documents\EclipseWorkspace\BU\BU.ice"
C:/Documents and Settings/Greg/My Documents/EclipseWorkspace/BU/BU.ice:32: syntax error
C:/Documents and Settings/Greg/My Documents/EclipseWorkspace/BU/BU.ice:33: `StringSeq' is not defined
============================================================

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Hmmm... I can't test this right now because I don't have a Windows machine handy. But I suspect the problem is that you should be using Ice::StringSeq, not StringSeq.

    Thanks,

    Michi.
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Hi,

    You can't define the sequence type inside of the struct definition, it needs to be done separately.
    module A
    {
    
    sequence<string> StringSeq;
    
    struct B
    {
        StringSeq ss;
        ...
    };
    
    };
    

    If you want to use the Ice builtin type instead then you need to use Ice::StringSeq instead of just StringSeq.

    Dwayne
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Ah, me bad--I slipped to the line below.

    Yes, Dwayne is right, of course: you can't define a sequence inside a struct. But StringSeq shouldn't compile either, unless you call it Ice::StringSeq.

    Cheers,

    Michi.
  • gsteele9gsteele9 Member Greg SteeleOrganization: RetiredProject: Backup System
    Problem resolved. Thanks a lot.

    Thanks for all the quick help. The responses cleared up both questions.
Sign In or Register to comment.