00001 /* ProcessAgent.h 00002 * 00003 * ------------------------------------------------------------------------------ 00004 * Copyright (c) 2008 Novell, Inc. All Rights Reserved. 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or modify it under 00008 * the terms of version 2 of the GNU General Public License as published by the 00009 * Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along with 00016 * this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may find 00019 * current contact information at www.novell.com. 00020 * ------------------------------------------------------------------------------ 00021 * 00022 * An agent for managing multiple processes. 00023 * 00024 * Authors: Ladislav Slezák <lslezak@novell.com> 00025 * 00026 * $Id: ProcessAgent.h 27914 2006-02-13 14:32:08Z locilka $ 00027 */ 00028 00029 #ifndef _ProcessAgent_h 00030 #define _ProcessAgent_h 00031 00032 #include <Y2.h> 00033 #include <scr/SCRAgent.h> 00034 00035 #include <map> 00036 00037 class Process; 00038 00042 class ProcessAgent : public SCRAgent 00043 { 00044 private: 00049 // typedef of internal data representation 00050 typedef map<pid_t, Process*> ProcessContainer; 00051 00052 ProcessContainer _processes; 00053 00054 private: 00055 00056 YCPValue ProcessOutput(std::string &output); 00057 00058 public: 00062 ProcessAgent(); 00063 00067 virtual ~ProcessAgent(); 00068 00074 virtual YCPValue Read(const YCPPath &path, 00075 const YCPValue& arg = YCPNull(), 00076 const YCPValue& opt = YCPNull()); 00077 00081 virtual YCPBoolean Write(const YCPPath &path, 00082 const YCPValue& value, 00083 const YCPValue& arg = YCPNull()); 00084 00088 virtual YCPValue Execute(const YCPPath &path, 00089 const YCPValue& value = YCPNull(), 00090 const YCPValue& arg = YCPNull()); 00091 00095 virtual YCPList Dir(const YCPPath& path); 00096 00100 virtual YCPValue otherCommand(const YCPTerm& term); 00101 }; 00102 00103 #endif /* _ProcessAgent_h */