/*  
 *    SCCS ID: %Z%%M% %I% %E% SST
 *
 *    Copyright (c) 1992-1993 Mark Soloway.  All rights reserved.
 *    See SST_LEGAL_NOTICE file for terms of the license. 
 */  
  
#ifndef _TREE_NODE_ADD_CHILD_MESSAGE_H
#define _TREE_NODE_ADD_CHILD_MESSAGE_H

#include "TTMessage.h"
#include "TreeNode.h"
#include "TreeNode_consts.h"

class TreeNodeAddChildMessage : public TTMessage {
public:
  TreeNodeAddChildMessage (const TreeNode &parent_node, Tt_status &status) :
    TTMessage (parent_node,
	       TREE_NODE_OP_ADD_CHILD,
	       TT_REQUEST,
	       TT_FILE,
	       status)
    {
      if (status == TT_OK) {
        status = addArg (TT_IN, "objid", (const char *)NULL);
      }
    }

  TreeNodeAddChildMessage (const char *parent_node_id, Tt_status &status) :
    TTMessage (parent_node_id,
               TREE_NODE_OP_ADD_CHILD,
               TT_REQUEST,
               TT_FILE,
               status)
    {
      if (status == TT_OK) {
        status = addArg (TT_IN, "objid", (const char *)NULL);
      }
    }  
 
  ~TreeNodeAddChildMessage () {}

  Tt_status setChildNode (const TreeNode &child_node)
    {
      Tt_status status;

      char *objid = child_node.getID (status);
      if (status < TT_WRN_LAST) {
        status = setArgValue (0, objid);
      }

      return status;
    }

  Tt_status setChildNode (const char *child_node_id)
    {
      return setArgValue (0, child_node_id);
    }
};

#endif
