secureswitools/swisistools/source/sisxlibrary/sisprerequisites.h
changeset 0 ba25891c3a9e
child 26 04d4a7bbc3e0
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * As specified in SGL.GT0188.251
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @publishedPartner
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __SISPREREQUISITES_H__
       
    27 #define __SISPREREQUISITES_H__
       
    28 
       
    29 #include "sisdependency.h"
       
    30 #include "sisarray.h"
       
    31 
       
    32 class CSISPrerequisites : public CStructure <CSISFieldRoot::ESISPrerequisites>
       
    33 	{
       
    34 public:
       
    35 	typedef CSISArray <CSISDependency, CSISFieldRoot::ESISDependency> TDependencyList;
       
    36 
       
    37 public:
       
    38 	/**
       
    39 	 * Default constructor.
       
    40 	 */
       
    41 	CSISPrerequisites ();
       
    42 	/**
       
    43 	 * Copy constructor.
       
    44 	 */
       
    45 	CSISPrerequisites (const CSISPrerequisites& aInitialiser);
       
    46 	/**
       
    47 	 * Class name
       
    48 	 */
       
    49 	virtual std::string Name () const;
       
    50 	/**
       
    51 	 * Add new dependency name to the existing list of names.
       
    52 	 * @param aName New dependency name.
       
    53 	 */
       
    54 	void AddDependencyName (const std::wstring& aName);
       
    55 	/**
       
    56 	 * Add a new dependency into the existing list of of dependencies.
       
    57 	 * @param aUID UID of the dependency.
       
    58 	 * @param aFrom From part of the dependency version range
       
    59 	 * @param aTo To part of the dependency version range 
       
    60 	 */
       
    61 	void AddDependency (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo);
       
    62 	/**
       
    63 	 * Add a new target name into the list of existing target names.
       
    64 	 * @param aName New target dependency name.
       
    65 	 */
       
    66 	void AddTargetName (const std::wstring& aName);
       
    67 	/**
       
    68 	 * Add a new target dependency into the existing list of of target dependencies.
       
    69 	 * @param aUID UID of the target.
       
    70 	 * @param aFrom From part of the target dependency version range
       
    71 	 * @param aTo To part of the target dependency version range 
       
    72 	 */
       
    73 	void AddTarget (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo);
       
    74 	/**
       
    75 	 * Checks if the UID is present in the list dependencies.
       
    76 	 * @param aUid UID to be searched.
       
    77 	 */
       
    78 	bool HasUID (const CSISUid& aUid) const;
       
    79 	/**
       
    80 	 * Adds the write the package details into the stream.
       
    81 	 * @param aStream - Stream in which the package entries need to be written.
       
    82 	 * @param aVerbose - If this option is set then detail description of pkg
       
    83 	 * 			will be written into the stream.
       
    84 	 */
       
    85 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
    86 	/**
       
    87 	 * Get the list of dependencies.
       
    88 	 */
       
    89 	inline const TDependencyList& DependencyList() const;
       
    90 	/**
       
    91 	 * Get the list of target dependencies.
       
    92 	 */
       
    93 	inline const TDependencyList& TargetDependencyList() const;
       
    94 
       
    95 private:
       
    96 	void InsertMembers ();
       
    97 
       
    98 private:
       
    99 	TDependencyList iTargetDevices;
       
   100 	TDependencyList iDependencies;
       
   101 	};
       
   102 
       
   103 
       
   104 inline CSISPrerequisites::CSISPrerequisites ()
       
   105 	{
       
   106 	InsertMembers (); 
       
   107 	}
       
   108 
       
   109 inline void CSISPrerequisites::InsertMembers ()
       
   110 	{
       
   111 	InsertMember (iTargetDevices);
       
   112 	InsertMember (iDependencies);
       
   113 	}
       
   114 
       
   115 inline CSISPrerequisites::CSISPrerequisites (const CSISPrerequisites& aInitialiser) :
       
   116 			CStructure <CSISFieldRoot::ESISPrerequisites> (aInitialiser),
       
   117 			iTargetDevices (aInitialiser.iTargetDevices),
       
   118 			iDependencies (aInitialiser.iDependencies)
       
   119 	{
       
   120 	InsertMembers (); 
       
   121 	}
       
   122 
       
   123 
       
   124 inline void CSISPrerequisites::AddDependencyName (const std::wstring& aName)
       
   125 	{
       
   126 	iDependencies.Last ().AddDependencyName (aName);
       
   127 	}
       
   128 
       
   129 
       
   130 inline void CSISPrerequisites::AddDependency (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo)
       
   131 	{
       
   132 	iDependencies.Push (CSISDependency (aUID, aFrom, aTo));
       
   133 	}
       
   134 
       
   135 
       
   136 inline void CSISPrerequisites::AddTargetName (const std::wstring& aName)
       
   137 	{
       
   138 	iTargetDevices.Last ().AddDependencyName (aName);
       
   139 	}
       
   140 
       
   141 
       
   142 inline void CSISPrerequisites::AddTarget (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo)
       
   143 	{
       
   144 	iTargetDevices.Push (CSISDependency (aUID, aFrom, aTo));
       
   145 	}
       
   146 
       
   147 
       
   148 inline std::string CSISPrerequisites::Name () const
       
   149 	{
       
   150 	return "Prerequisites";
       
   151 	}
       
   152 
       
   153 inline const CSISPrerequisites::TDependencyList& CSISPrerequisites::DependencyList() const
       
   154 	{
       
   155 	return iDependencies;
       
   156 	}
       
   157 inline const CSISPrerequisites::TDependencyList& CSISPrerequisites::TargetDependencyList() const
       
   158 	{
       
   159 	return iTargetDevices;
       
   160 	}
       
   161 
       
   162 
       
   163 #endif // __SISPREREQUISITES_H__
       
   164